微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android 应用程序在测试发布版本 (apk) 时崩溃,但在开发中工作

如何解决Android 应用程序在测试发布版本 (apk) 时崩溃,但在开发中工作

当我按下 FlatList 中的一个项目时,应用程序崩溃,它应该导航到该项目屏幕,但由于某种原因应用程序不断崩溃。它适用于流程的每个阶段,直到我将 apk 文件拖放到模拟器上或在我的手机上打开它,然后它一直崩溃。

这是平面列表:

 <Animated.FlatList
      data={listings} // to have all the data
      ref={ref}
      keyExtractor={(listing) => listing.id.toString()}
      renderItem={({ item,index }) => (
        <Card
          title={item.title}
          subTitle={item.price+" "+I18n.t('ListingDetailsScreen.EGP')}
          imageUrl={item.images[0].url}
          onPress={() => navigation.navigate(routes.LISTING_DETAILS,{listing:item,index,updateView})}
          thumbnailUrl={item.images[0].thumbnailUrl}
        />
      )}
      refreshing={refreshing}
      onRefresh={() => {
        {!error ? setPage(0)&loadListings():null};
      }}
      onEndReached={handleLoadMore}
      onEndReachedThreshold={0.000001}
      initialNumToRender={10}
      scrollsToTop={true}
      style={Platform.OS==="ios"?{marginTop,paddingTop}:null}      
      contentContainerStyle={Platform.OS==="ios"?{paddingBottom:60}:null} 
      onScroll={(e) => {
                            if ( e.nativeEvent.contentOffset.y > 0 && 
                              e.nativeEvent.contentOffset.y < 
                              (e.nativeEvent.contentSize.height - e.nativeEvent.layoutMeasurement.height))           
                              scrollY.setValue(e.nativeEvent.contentOffset.y);
                          }}
      scrollEventThrottle={16}
    />

这是我的 package.json

{
"main": "node_modules/expo/AppEntry.js","scripts": {
"start": "expo start","android": "expo start --android","ios": "expo start --ios","web": "expo start --web","eject": "expo eject"
},"dependencies": {
"@bugsnag/expo": "^7.3.5","@material-ui/core": "^4.11.0","@react-native-community/async-storage": "~1.11.0","@react-native-community/hooks": "^2.6.0","@react-native-community/masked-view": "0.1.10","@react-native-community/netinfo": "5.9.2","@react-navigation/bottom-tabs": "^5.9.2","@react-navigation/native": "^5.7.6","@react-navigation/stack": "^5.9.3","apisauce": "^1.1.2","dayjs": "^1.9.3","expo": "^40.0.0","expo-blur": "~8.1.2","expo-constants": "^9.2.0","expo-image-picker": "~8.3.0","expo-localization": "~8.2.1","expo-location": "~8.2.1","expo-permissions": "~9.0.1","expo-secure-store": "~9.0.1","expo-status-bar": "^1.0.2","formik": "^2.1.4","i18n-js": "^3.8.0","jwt-decode": "^3.0.0","lottie-react-native": "~2.6.1","moment": "^2.29.1","react": "~16.11.0","react-dom": "~16.11.0","react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz","react-native-elements": "^3.0.0-alpha.1","react-native-expo-image-cache": "^4.1.0","react-native-gesture-handler": "~1.6.0","react-native-image-pan-zoom": "^2.1.12","react-native-image-zoom-viewer": "^3.0.1","react-native-maps": "0.27.1","react-native-progress": "^4.1.2","react-native-reanimated": "~1.9.0","react-native-safe-area-context": "~3.0.7","react-native-screens": "~2.9.0","react-native-size-matters": "^0.3.1","react-native-svg": "12.1.0","react-native-vector-icons": "^7.1.0","react-native-web": "~0.11.7","react-native-webview": "^11.0.2","socket.io-client": "^3.0.4","yup": "^0.29.3"
 },"devDependencies": {
"@babel/core": "^7.8.6","babel-preset-expo": "~8.1.0","react-native-dotenv": "^2.5.0"
},"private": true
}

app.json

{
"expo": {
"name": "test","slug": "test","platforms": ["ios","android","web"],"version": "1.0.0","orientation": "portrait","icon": "./App/assets/icon.png","splash": {
  "image": "./App/assets/test.png","resizeMode": "cover","backgroundColor": "#fff"
},"updates": {
  "fallbackToCacheTimeout": 0
},"assetBundlePatterns": [
  "**/*"
],"ios": {
  "supportsTablet": true,"bundleIdentifier":"com.test.test","buildNumber":"1.0.0","infoPlist": {
    "NSCameraUsageDescription": "This app uses the camera to let user put a photo in his profile page."
  }
},"android":{
  "package":"com.test.test","versionCode":3,"permissions":["CAMERA","CAMERA_ROLL","ACCESS_COARSE_LOCATION","ACCESS_FINE_LOCATION","WRITE_EXTERNAL_STORAGE","READ_EXTERNAL_STORAGE"]
},"web": {
  "favicon": "./assets/favicon.png"
},"notification": {
  "iosdisplayInForeground": true
},}
}

我使用的是世博会管理的工作流程,所以我不会退出世博会。

我还运行了命令 abd logcat 并在需要时得到响应,请询问,我会添加它。

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。