单击登录按钮后,React本机释放签名的APK文件崩溃



我使用以下链接创建了我的应用程序的APK文件。

https://facebook.github.io/react-native/docs/signed-apk-android#docsNav

成功地安装了它,一旦我单击登录按钮,它显示了"不幸的是,该应用程序已关闭错误"。我尝试创建其他项目的APK,并且运行良好。但是,在这个项目中,它崩溃了。

创建项目后一次,我更改了项目名称是String.xml文件。有什么问题吗?甚至还试图保留先前的名字,但我的问题没有得到解决。我的package.json文件是

{
  "name": "awsUpload",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "aws-sdk": "^2.395.0",
    "link": "^0.1.5",
    "react": "16.6.3",
    "react-native": "^0.58.3",
    "react-native-aws3": "0.0.8",
    "react-native-device-info": "^0.26.2",
    "react-native-file-upload": "^1.0.4",
    "react-native-image-picker": "^0.28.0",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-router-flux": "^4.0.6",
    "uniqid": "^5.0.3"
  },
  "devDependencies": {
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "24.0.0",
    "jest": "24.0.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

我的包装中有任何问题吗?

我的按钮文件代码是

import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Dimensions from 'Dimensions';
import {
  StyleSheet,
  TouchableOpacity,
  Text,
  Animated,
  Easing,
  Image,
  Alert,
  View,
} from 'react-native';
import {Actions, ActionConst} from 'react-native-router-flux';
import spinner from '../images/loading.gif';
const DEVICE_WIDTH = Dimensions.get('window').width;
const DEVICE_HEIGHT = Dimensions.get('window').height;
const MARGIN = 40;
export default class ButtonSubmit extends Component {
  constructor() {
    super();
    this.state = {
      isLoading: false,
    };
    this.buttonAnimated = new Animated.Value(0);
    this.growAnimated = new Animated.Value(0);
    this._onPress = this._onPress.bind(this);
  }
  _onPress() {
    if (this.state.isLoading) return;
    this.setState({isLoading: true});
    Animated.timing(this.buttonAnimated, {
      toValue: 1,
      duration: 200,
      easing: Easing.linear,
    }).start();
    setTimeout(() => {
      this._onGrow();
    }, 2000);
    setTimeout(() => {
      Actions.secondScreen();
      this.setState({isLoading: false});
      this.buttonAnimated.setValue(0);
      this.growAnimated.setValue(0);
    }, 2300);
  }
  _onGrow() {
    Animated.timing(this.growAnimated, {
      toValue: 1,
      duration: 200,
      easing: Easing.linear,
    }).start();
  }
  render() {
    const changeWidth = this.buttonAnimated.interpolate({
      inputRange: [0, 1],
      outputRange: [DEVICE_WIDTH - MARGIN, MARGIN],
    });
    const changeScale = this.growAnimated.interpolate({
      inputRange: [0, 1],
      outputRange: [1, MARGIN],
    });
    return (
      <View style={styles.container}>
        <Animated.View style={{width: changeWidth}}>
          <TouchableOpacity
            style={styles.button}
            onPress={this._onPress}
            activeOpacity={1}>
            {this.state.isLoading ? (
              <Image source={spinner} style={styles.image} />
            ) : (
              <Text style={styles.text}>LOGIN</Text>
            )}
          </TouchableOpacity>
          <Animated.View
            style={[styles.circle, {transform: [{scale: changeScale}]}]}
          />
        </Animated.View>
      </View>
    );
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    top: -95,
    alignItems: 'center',
    justifyContent: 'flex-start',
    marginTop: 100,
  },
  button: {
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor : '#48a4ff',
    height: MARGIN,
    borderRadius: 20,
    zIndex: 100,
  },
  circle: {
    height: MARGIN,
    width: MARGIN,
    marginTop: -MARGIN,
    borderWidth: 1,
    borderColor: 'blue',
    borderRadius: 100,
    alignSelf: 'center',
    zIndex: 99,
    backgroundColor: '#48a4ff',
  },
  text: {
    color: 'white',
  },
  image: {
    width: 24,
    height: 24,
  },
});

问题不是我的代码,我正在使用一组代码访问设备位置,因此它在更高版本的Android设备由于安全原因

i 已解决访问以下链接

如何在运行时请求Android设备位置的Android设备位置?

相关内容

  • 没有找到相关文章

最新更新