Google.JarResolver.ResolutionException:无法解析com.google.firebase:firebase-analytics-unity:1.0.0()

时间:2016-11-30 07:50:34

标签: unity3d firebase onesignal

在我的Unity项目中,我使用了一些资产,如FacebookSDK,OneSignal等。每当我导入OneSignal时,都会显示此错误。

  

Google.JarResolver.ResolutionException:无法解析com.google.firebase:firebase-analytics-unity:1.0.0()

我尝试了很多东西,这些都是我记得的:

  • 使用“播放服务解析程序”无法解决问题。
  • 导入Unity Firebase。

当我导入Firebase时,错误会变成另一个错误,即构建与Firebase相关的名为CommandInvokationFailure的错误。

我花了几天时间修理它,但我还是不能。如果您需要更多信息,请告诉我。

编辑:@nika感谢您的回复。我尝试了API 23-24-25的每个组合,并从23到25构建工具。但是,我还无法修复'CommandInvokationFailure'。我认为分享错误的完整日志会更好:

CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/emre/Desktop/AndroidSDK/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzah;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzcn;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/BuildConfig;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoJellyBeanMr2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/animation/AnimatorCompatHelper;

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at SDKMain.main(SDKMain.java:129)
Caused by: java.lang.InterruptedException: Too many errors
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
    ... 9 more
]

编辑2:@jkasten感谢您的回复。我可以修复 Android支持库v4错误,但是,由于解析器,第二个问题并不容易。

play-services files

没有重复的播放服务文件。这一次,我即兴解决它:通过更改导入设置从android版本中删除play-services-ads-9.0.1(如果删除了其他广告文件,则CommandInvokationFailure错误仍在继续。)。我真的不知道这是解决问题的正确方法,但它以某种方式起作用。但是当我尝试在手机上运行游戏时,它会导致另一个错误:

FATAL EXCEPTION: main
E/AndroidRuntime(18680): java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/app/***/base.apk)
E/AndroidRuntime(18680):    at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source)
E/AndroidRuntime(18680):    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
E/AndroidRuntime(18680):    at android.app.ActivityThread.installProvider(ActivityThread.java:5159)
E/AndroidRuntime(18680):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4754)
E/AndroidRuntime(18680):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4694)
E/AndroidRuntime(18680):    at android.app.ActivityThread.access$1600(ActivityThread.java:150)
E/AndroidRuntime(18680):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
E/AndroidRuntime(18680):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(18680):    at android.os.Looper.loop(Looper.java:148)
E/AndroidRuntime(18680):    at android.app.ActivityThread.main(ActivityThread.java:5423)
E/AndroidRuntime(18680):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18680):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
E/AndroidRuntime(18680):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

1 个答案:

答案 0 :(得分:3)

从日志中的以下两个唯一行:

Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzcn;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/BuildConfig;

这意味着您的项目中有Google Play services libraryAndroid Support Library v4的两个或更多副本。

修复Android支持库v4错误(支持/ v4)

为了在同一个Unity项目中一起使用OneSignal和Facebook SDK,您需要删除OneSignal troubleshooting guide中注明的以下重复库。

FacebookSDK/plugins/android/libs/support-v4-23.4.0.aar
FacebookSDK/plugins/android/libs/support-annotations-23.4.0.aar

这将解决already added: Landroid/support/v4错误,除非它们是您项目中的第3个插件。

修复Google Play服务库错误(gms)

我建议删除Unity项目中的重复play-services-[library]-[version].aar个文件。会有不同的[libraries]但是对于所有play-services-*.aar文件应该只有一个版本。这应该可以解决already added: Lcom/google/android/gms错误。

如果您遇到问题,请使用版本号的完整插件列表更新您的问题。同时列出项目中的所有.aar.jar文件。另外,您可以创建一个新项目并一次添加一个插件,直到您收到错误来指出插件组合产生问题。