gpt4 book ai didi

android - java.lang.NoClassDefFoundError : Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; 错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:31:45 31 4
gpt4 key购买 nike

我的环境:

native react :0.50.4

安卓工作室:3.1.1

Gradle :4.6

设备:Android 模拟器(任何 Android 操作系统)

我正在更新我当前的 React native 应用以开始使用 Firebase。我正在使用 react-native-firebase 包来集成它们,但我非常肯定这不是问题,因为我的问题在我开始处理这些东西之前就出现了。

这是我的一些来源:

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.2'
}
}

allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
google()
}
}

'app/build.gradle`:

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion '27.0.3'

defaultConfig {
applicationId "com.ourdailystrength.mobile.android"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}

dependencies {
//compile(project(':react-native-firebase')) {
// transitive = false
//}
compile project(':react-native-config')
compile project(':react-native-i18n')
compile project(':react-native-vector-icons')
compile project(':react-native-device-info')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.50.4" // From node_modules

// firebase modules
implementation "com.google.android.gms:play-services-base:12.0.1"
implementation "com.google.firebase:firebase-core:12.0.1"

}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply plugin: 'com.google.gms.google-services'

构建并运行应用程序后,出现以下错误:

           java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6378)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5939)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5856)
at android.app.ActivityThread.access$1100(ActivityThread.java:193)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1623)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.ourdailystrength.mobile.android-mFoP1bOjnUTgeG_cDvnVkg==/base.apk"],nativeLibraryDirectories=[/data/app/com.ourdailystrength.mobile.android-mFoP1bOjnUTgeG_cDvnVkg==/lib/x86, /system/fake-libs, /data/app/com.ourdailystrength.mobile.android-mFoP1bOjnUTgeG_cDvnVkg==/base.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2) 
at android.app.ActivityThread.installProvider(ActivityThread.java:6378) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5939) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5856) 
at android.app.ActivityThread.access$1100(ActivityThread.java:193) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1623) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) 

我确实尝试从 12.0.1 升级到 15.0.0 并让它构建并运行良好,但是在发送 Firebase 消息时,它提示关于 Google Play 服务已过时。收到此错误:

W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 12446024
W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
V/FA: Processing queued up service tasks: 1
E/FA: Discarding data. Failed to send event to service

我是在 Android P 上运行的,所以我认为 Google Play 服务在这方面不会过时。我找不到 Google 在哪里记录 google play 服务的发布,因为我有预感 12.4.51.000 还不存在。

我已经尝试找到这个问题的答案,但没有任何帮助。任何事情都会有所帮助。谢谢!

最佳答案

我找到了解决方案。

  1. 将依赖项中的所有内容更新为 15.0.0。是的,它会不断向您提供有关过时的 Google Play 服务的错​​误,但没关系。

  2. 创建一个安装了 Google Play 商店的新模拟器(目前,我认为它只是 Nexus 5 和 5X)。

  3. 打开模拟器并更新 google play 服务。您需要先打开 Google Play 并登录。完成后,您应该会收到更新 Google Play 服务的通知。

  4. 更新完成后,您可以在设置中检查它是什么版本以及它是否足够新(应该足够新)。

  5. 卸载应用程序并重新安装应用程序。它现在应该可以正常工作了。

关于android - java.lang.NoClassDefFoundError : Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49825493/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com