Android App crashes when testing release build (apk) but works in dev

拜拜、爱过 提交于 2021-02-05 11:45:29

问题


the app crashes when i press on an item in a FlatList, its supposed to navigate to that items screen but instead the app keeps crashing for some reason. It works in every stage of the process until when i drag and drop the apk file on the emulator or open it on my phone then it keeps crashing.

Here is the flatlist:

 <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}
    />

Here is my 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
},
}
}

I am using expo managed workflow and so i am not ejecting from expo.

I also ran the command abd logcat and have the response if required please ask and i will add it.

Thank you

来源:https://stackoverflow.com/questions/66008709/android-app-crashes-when-testing-release-build-apk-but-works-in-dev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!