在现有项目中安装和配置react-native-maps
和@react-native-firebase/app
后,使我的应用程序崩溃。
环境信息
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Memory: 2.08 GB / 11.90 GB
Binaries:
Node: 10.16.0 - C:Program Filesnodejsnode.EXE
Yarn: 1.9.4 - C:Program Files (x86)Yarnbinyarn.CMD
npm: 6.9.0 - C:Program Filesnodejsnpm.CMD
SDKs:
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.1, 28.0.2, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5900203
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.4 => 0.61.4
我的应用程序依赖项的一部分:
"@react-native-firebase/app": "^6.0.3",
"react-native-maps": "0.26.1",
复制步骤
我通过Aandroid studio
进行了调试,得到了以下错误
--------崩溃开始11-13 15:00:24.209 4709-4746/com.melk.android E/AndroidRuntime:致命异常:mqt_native_modules进程:com.melk.android,PID:4709java.lang.NoClassDefFoundError:com.google.android.gms.maps.GoogleMapOptions网址:com.airbnb.android.areact.maps.AirMapManager.(AirMapManager.java:60(网址:com.airbnb.android.areact.maps.MapsPackage.createViewManagers(MapsPackage.java:40(网址:com.facebook.reflect.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:782(网址:com.facebook.reflect.CoreModulesPackage.createUIManager(CoreModulesPackage.java:184(网址:com.facebook.reflect.CoreModulesPackage.getModule(CoreModulesPackage.java:152(网址:com.facebook.reflect.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:122(网址:com.facebook.reflect.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:110(网址:com.facebook.reflect.bridge.ModuleHolder.create(ModuleHolder.java:188(网址:com.facebook.reflect.bridge.ModuleHolder.getModule(ModuleHolder.java:153(网址:com.facebook.reflect.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:148(网址:com.facebook.areact.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:479(网址:com.facebook.areact.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:466(网址:com.facebook.reflect.uimanager.UIManagerHelper.getUIManager(UIManagerHelpr.java:31(网址:com.facebook.areact.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1054(网址:com.facebook.areact.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1012(网址:com.facebook.areact.ReactInstanceManager.access$1400(ReactInstanceManager.java:125(网址:com.facebook.areact.ReactInstanceManager$5$2.run(ReactInstanceManager.java:972(在android.os.Handler.handleCallback(Handler.java:739(在android.os.Handler.dispatchMessage(Handler.java:95(网址:com.facebook.reflect.bridge.cqueue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26(在android.os.Looper.loop(Looper.java:148(网址:com.facebook.reflect.bridge.cqueue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225(在java.lang.Thread.run(Thread.java:818(
可复制示例代码
android/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
classpath 'com.google.gms:google-services:4.2.0'
}
}
问题:当你的壁画库版本与动画gif或任何其他库不匹配时,就会出现这个问题。
解决方案1:(我的要求是使用动画gif库,所以我的版本与壁画和动画gif相同。也就是说,你各自的版本应该相同(
implementation'com.facebook.w壁画:壁画:2.6.0'
implementation'com.facebook.w壁画:动画gif:2.6.0'
解决方案2:(仅供建议,不使用(
降级react本机版本的一个版本。[我将要求您仅使用上述解决方案]