報(bào)錯(cuò)1?Failed to compile resources with the following parameters:-bootclasspath "E:\software\Android\AndroidSDK_ForUnity5\platforms\android-24\android.jar" -d "D:\h5\UnityProjects\IceClimber\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "android\support\customtabs\R.java" "android\support\graphics\drawable\R.java" "android\support\graphics\drawable\animated\R.java" "android\support\v4\R.java" "android\support\v7\appcompat\R.java" "android\support\v7\cardview\R.java" "com\facebook\R.java" "com\facebook\android\R.java" "com\herofun\iceclimber\R.java"解決方案:?可能是jdk版本低了,使用jdk8解決。報(bào)錯(cuò)2?IOException: Failed to Move File / Directory from 'Temp/StagingArea\android-libraries\app-debug\classes.jar' to 'Temp/StagingArea\android-libraries\app-debug\libs\classes.jar'.UnityEditor.Android.PostProcessor.Tasks.ProcessAAR.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186)UnityEditor.HostView:OnGUI()解決方案刪除aar中的libs/classes.jar報(bào)錯(cuò)3?Error: [Temp\StagingArea\AndroidManifest-main.xml:12,?D:\h5\UnityProjects\Test\AARTest\Temp\StagingArea\android-libraries\app-debug\AndroidManifest.xml:3]?Main manifest has <uses-sdk android:minSdkVersion='9'> but library uses minSdkVersion='15'UnityEditor.HostView:OnGUI()解決方案在Unity的PlayerSetting中把minSdkVersion設(shè)成與第三方庫中的minSdkVersion一致報(bào)錯(cuò)4?CommandInvokationFailure: Failed to re-package resources.E:\software\Android\AndroidSDK_ForUnity5\build-tools\24.0.1\aapt.exe package?--auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I??"E:\software\Android\AndroidSDK_ForUnity5\platforms\android-25\android.jar"??-F bin/resources.ap_ --extra-packages com.zwwx.game.gamesupport -S??"D:\h5\UnityProjects\Test\AARTest\Temp\StagingArea\android-libraries\app-debug\res"錯(cuò)誤原因build-tools用的版本是24,platforms版本用的是android-25, 兩個(gè)版本不一致導(dǎo)致報(bào)錯(cuò)。解決方案使用platforms/android-24打包報(bào)錯(cuò)5?CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.?E:\software\Java\jdk8\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:\software\Android\AndroidSDK_ForUnity5\tools" -Dfile.encoding=UTF8 -jar "E:\software\Unity5_5\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -stdout[Warning: [Temp\StagingArea\AndroidManifest-main.xml:12,?D:\h5\UnityProjects\Test\AARTest\Temp\StagingArea\android-libraries\app-debug\AndroidManifest.xml:3]?Main manifest has <uses-sdk android:targetSdkVersion='23'> but library uses targetSdkVersion='25']錯(cuò)誤原因第三方庫與Unity中用的SDK的targetSdkVersion版本不一致。解決方案Unity使用targetSdkVersion='25'打包。Android SDK升級(jí)到以下版本platforms/android-25、tools_r25.2.5-windows、build-tools_r25.0.2-windows注意:最新版本的tools下沒有android.bat命令,打包會(huì)報(bào)Error:Invalid command android錯(cuò)誤報(bào)錯(cuò)6?CommandInvokationFailure: Unable to list target platforms.Please make sure the android sdk path is correct. See the Console for more details.?E:\software\Java\jdk8\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:\software\Android\AndroidSDK\tools" -Dfile.encoding=UTF8 -jar "E:\software\Unity5_5\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -stderr[Error:Invalid command android]錯(cuò)誤原因新版本的tools下沒有android.bat命令,所以打包時(shí)報(bào)Error:Invalid command android解決方案下個(gè)舊版本的tools再打包。tools_r25.2.5-windows.zip報(bào)錯(cuò)7?UnityException: Adding Android library projects failed!UnityEditor.Android.AndroidLibraries.AddLibraryProject (System.String projectPropertiesPath)UnityEditor.Android.AndroidLibraries.FindAndAddLibraryProjects (System.String searchPattern)UnityEditor.Android.PostProcessor.Tasks.AddAndroidLibraries.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)錯(cuò)誤原因aar中的某些文件被刪除了,比如aar中的AndroidManifest.xml被刪除了。解決方案重新生成個(gè)aar報(bào)錯(cuò)8?Error:Execution failed for task ':processReleaseGoogleServices'.> No matching client found for package name 'com.zwwx.game.WinterJump'原因:google-services.json中的包名與build.gradle中的包名不一致。解決方案:改成一致就行了。報(bào)錯(cuò)9?用gradle build打包時(shí)報(bào)以下錯(cuò)?To run dex in process, the Gradle daemon needs a larger heap.It currently has 1024 MB.For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.For more information see https://docs./current/userguide/build_environment.html原因:gradle需要更大內(nèi)存?解決方案: 修改gradle-wrapper.properties文件。?在gradle-wrapper.properties文件中添加一條配置?set? org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m報(bào)錯(cuò)10?Parsing json file: D:\xxx\google-services.json:processDebugGoogleServices FAILEDFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':processDebugGoogleServices'.> No matching client found for package name 'com.xx.xxx.xxxxx'* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.原因:google-services.json中定義的包名與AndroidManifest.xml中定義的包名不一致。?解決方案:包名改一致。報(bào)錯(cuò)11Rejecting re-init on previously-faile d class java.lang.Class<com.helpshift.support.adapters.QuestionListAdapter>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/RecyclerView$Adapter;解決方案: 刪除libs下的android-support-v4.jar保留android-support-v7-appcompat.jar報(bào)錯(cuò)12CommandInvokationFailure: Unable to convert classes into dex format.E:/JavaJDK/jdk\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:/androidsdk\tools" -Dfile.encoding=UTF8 -jar "F:\unity\Editor\Data\PlaybackEngines\Player/Tools\sdktools.jar" -stderr[Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0我出現(xiàn)這個(gè)問題的時(shí)候下面的提示還沒有看只看上面紅字部分,說明jdk版本太低,我原來是1.7的換成1.8果斷好使報(bào)錯(cuò)13Error:(26, 9) Attribute application@icon value=(@drawable/logo) from AndroidManifest.xml:26:9Error:(28, 9) Attribute application@theme value=(@style/ThemeActionBar) from AndroidManifest.xml:28:9is also present at XXXX-trunk:XXXXLib:unspecified:15:9 value=(@style/AppTheme)Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:24:5 to overrideError:Execution failed for task ':XXXX:processDebugManifest'.> Manifest merger failed with multiple errors, see logs原因:AS的Gradle插件默認(rèn)會(huì)啟用Manifest Merger Tool,若Library項(xiàng)目中也定義了與主項(xiàng)目相同的屬性(例如默認(rèn)生成的android:icon和android:theme),則此時(shí)會(huì)合并失敗,并報(bào)上面的錯(cuò)誤。解決方法有以下2種:方法1: 在Manifest.xml的application標(biāo)簽下添加tools:replace="android:icon, android:theme"(多個(gè)屬性用,隔開,并且記住在manifest根標(biāo)簽上加入xmlns:tools="http://schemas./tools",否則會(huì)找不到namespace哦)方法2: 在build.gradle根標(biāo)簽上加上useOldManifestMerger true (懶人方法)報(bào)錯(cuò)14:Library Project里面的 BuildConfig.DEBUG永遠(yuǎn)都是false 。這是Android Studio的一個(gè)已知問題,某Google的攻城獅說,Library projects目前只會(huì)生成release的包。Issue 52962: https://code.google.com/p/android/issues/detail?id=52962解決方法: (某Google的攻城獅推薦的方法)Workaround: instaed of BuildConfig.DEBUG create another boolean variable at lib-project's e.g. BuildConfig.RELEASE and link it with application's buildType.?https://gist.github.com/almozavr/d59e770d2a6386061fcb參考stackoverflow 上的這篇帖:http:///questions/20176284/buildconfig-debug-always-false-when-building-library-projects-with-gradle報(bào)錯(cuò)15:每次保存的時(shí)候,每行多余的空格和TAB會(huì)被自動(dòng)刪除(例如結(jié)尾、空行的多余空格或TAB)特別是每次準(zhǔn)備提交SVN,Review代碼時(shí)候你就蛋疼了,顯示一堆不相關(guān)的更改,看的眼花。解決方法:Settings->IDE Settings->Editor->Other->Strip trailing spaces on Save->None問題四:編譯的時(shí)候,報(bào):Failure [INSTALL_FAILED_OLDER_SDK]。一般是系統(tǒng)自動(dòng)幫你設(shè)置了compileSdkVersion?解決方法:修改build.gradle下的compileSdkVersion 'android-L'為compileSdkVersion 19(或者你本機(jī)已有的SDK即可)來源:http://www./content-4-129551.html |
|