使用Gradle构建时,Unity的Firebase Messaging Package会出现问题

时间:2017-06-23 14:02:37

标签: android firebase unity3d firebase-cloud-messaging unity5

起初我可以在我的Android设备上构建和安装应用程序但是当我发布它崩溃时,Logcat说Firebase库没有包含在软件包中,并建议使用Play Services Jar Resolver。所以我用它了。

现在我在尝试构建应用时出现此错误。 (对不起,我有一些问题了解如何插入代码片段:))

    CommandInvokationFailure: Gradle build failed. 
    /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleRelease"

    stderr[
    /Users/andreamarchetti/Desktop/Squarcuit/Temp/gradleOut/src/main/AndroidManifest.xml:4: Error: Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one [HardcodedDebugMode]
      <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">

类型问题的解释&#34; HardcodedDebugMode&#34;:    最好从清单中省略android:debuggable属性。    如果你这样做,那么这些工具会自动插入android:debuggable = true    在构建APK以在模拟器或设备上进行调试时。当你    执行发布版本,例如导出APK,它会自动设置    它是假的。

另一方面,如果您在清单文件中指定特定值,    然后工具将始终使用它。这可能导致意外发布    您的应用程序包含调试信息。

1 errors, 0 warnings
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        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)


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
stdout[
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:preDebugBuild UP-TO-DATE
:Firebase:preBuild UP-TO-DATE
:Firebase:preReleaseBuild UP-TO-DATE
:Firebase:compileReleaseNdk UP-TO-DATE
:Firebase:compileLint
:Firebase:copyReleaseLint UP-TO-DATE
:Firebase:mergeReleaseProguardFiles
:Firebase:packageReleaseRenderscript UP-TO-DATE
:Firebase:checkReleaseManifest
:Firebase:prepareReleaseDependencies
:Firebase:compileReleaseRenderscript
:Firebase:generateReleaseResValues
:Firebase:generateReleaseResources
:Firebase:packageReleaseResources
:Firebase:compileReleaseAidl
:Firebase:generateReleaseBuildConfig
:Firebase:mergeReleaseShaders
:Firebase:compileReleaseShaders
:Firebase:generateReleaseAssets
:Firebase:mergeReleaseAssets
:Firebase:processReleaseManifest
:Firebase:processReleaseResources
:Firebase:generateReleaseSources
:Firebase:incrementalReleaseJavaCompilationSafeguard
:Firebase:compileReleaseJavaWithJavac
:Firebase:processReleaseJavaRes UP-TO-DATE
:Firebase:transformResourcesWithMergeJavaResForRelease
:Firebase:transformClassesAndResourcesWithSyncLibJarsForRelease
:Firebase:mergeReleaseJniLibFolders
:Firebase:transformNative_libsWithMergeJniLibsForRelease
:Firebase:transformNative_libsWithSyncJniLibsForRelease
:Firebase:bundleRelease
:prepareAnimatedVectorDrawable2340Library
:prepareAppcompatV72340Library
:prepareCardviewV72340Library
:prepareCustomtabs2340Library
:prepareFacebookAndroidSdk4170Library
:prepareFacebookAndroidWrapper794Library
:prepareFirebaseAppUnity401Library
:prepareFirebaseCommon1100Library
:prepareFirebaseIid1100Library
:prepareFirebaseMessaging1100Library
:prepareFirebaseMessagingUnity401Library
:prepareGradleOutFirebaseUnspecifiedLibrary
:preparePlayServicesBase1100Library
:preparePlayServicesBasement1100Library
:preparePlayServicesTasks1100Library
:prepareSupportCompat2520Library
:prepareSupportCoreUi2520Library
:prepareSupportCoreUtils2520Library
:prepareSupportFragment2520Library
:prepareSupportMediaCompat2520Library
:prepareSupportV42340Library
:prepareSupportV42520Library
:prepareSupportVectorDrawable2340Library
:prepareReleaseDependencies
:compileReleaseAidl
:compileReleaseRenderscript
:generateReleaseBuildConfig
:mergeReleaseShaders
:compileReleaseShaders
:generateReleaseAssets
:mergeReleaseAssets
:generateReleaseResValues
:generateReleaseResources
:mergeReleaseResources
:processReleaseManifest
:processReleaseResources
:generateReleaseSources
:incrementalReleaseJavaCompilationSafeguard
:compileReleaseJavaWithJavac
:compileReleaseNdk UP-TO-DATE
:compileReleaseSources
:lintVitalRelease
:prePackageMarkerForRelease
:transformClassesWithDexForRelease
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:transformClassesWithDexForRelease FAILED

BUILD FAILED

Total time: 45.841 secs
]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()

我的项目中的任何AndroidManifest.xml中都没有 - android:debuggable="false" -

1 个答案:

答案 0 :(得分:0)

我认为问题是我有多个相同包但不同版本的.aar文件。所以Facebook SDK与一些谷歌Firebase的东西相冲突。我删除了Facebook SDK .aar(旧版本)。