解析失败:lcom/google/android/gms/common/api/Api$zzf;

当我们运行应用程序的 apk 文件时出现此错误。在build.gradle我们设置 multidex 和编译 multidex 存在于 Gradle 文件中。我们将 Firebase 版本的版本更改为上和下,但这对我们不起作用。这是我们在运行控制台中的完整日志:


D/AndroidRuntime: Shutting down VM

E/AndroidRuntime: FATAL EXCEPTION: main

                  Process: ir.parsinteam.ojoobe, PID: 5141

                  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;

                      at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)

                      at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101)

                      at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40)

                      at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45)

                      at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390)

                      at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148)

                      at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134)

                      at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110)

                      at ir.adad.client.Adad.initialize(Adad.java:22)

                      at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62)

                      at android.app.Activity.performCreate(Activity.java:6662)

                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)

                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)

                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)

                      at android.app.ActivityThread.-wrap12(ActivityThread.java)



哈士奇WWW
浏览 319回答 3
3回答

MM们

我修复了这个问题。请按照下面的代码。添加了以下内容android/build.gradleallprojects {&nbsp; &nbsp; repositories {&nbsp; &nbsp; //start here&nbsp; &nbsp; configurations.all {&nbsp;resolutionStrategy.eachDependency { DependencyResolveDetails details ->&nbsp; &nbsp;def requested = details.requested&nbsp; &nbsp; &nbsp; &nbsp;if (requested.group == 'com.google.android.gms') {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; details.useVersion '12.0.1'&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp;if (requested.group == 'com.google.firebase') {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; details.useVersion '12.0.1'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; //end&nbsp; &nbsp; &nbsp;jcenter()&nbsp; &nbsp; &nbsp; &nbsp;maven {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;url "https://maven.google.com"&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp;}&nbsp;}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java