Search Unity

APK Build Failing

Discussion in 'Android' started by LostInTheMachine, Jun 27, 2013.

  1. LostInTheMachine

    LostInTheMachine

    Joined:
    Aug 8, 2010
    Posts:
    48
    Hi all,

    It's been a while since I released an Android game, but it's now time to build an Android version of my current project. I have latest of EVERYTHING, Pro everything, latest Android SDK with everything downloaded. Unity knows where the SDK location is but the Player Build fails right at the end every time spitting out the exception error message below.

    I was able to build an apk but only with an old version of the SDK Tools.....I forget now, maybe 17....and then I updated.....and now it's broken. SURELY I don't have to unwind to a previous version?

    Wondering if my issues per project specific I created a simple test project. This project output below is just a very simple project to display a 3d model.....and THAT's IT!

    I haven't set up a keystore yet but I only need that for publishing right?

    My device filter only allows ARM 7. Is that normal?

    Googling has not been helpful. Help!

    Scott

    --------------------------------------------------------------------------------------------
    Error building Player: Exception: apk (invokation failed)
    ERROR: unknown error
    cmd:apk /Users/scott_a_ashton/Desktop/Ganesh/Temp/StagingArea/Package_unaligned.apk -z /Users/scott_a_ashton/Desktop/Ganesh/Temp/StagingArea/assets.ap_ -z /Users/scott_a_ashton/Desktop/Ganesh/Temp/StagingArea/bin/resources.ap_ -nf /Users/scott_a_ashton/Desktop/Ganesh/Temp/StagingArea/libs -f /Users/scott_a_ashton/Desktop/Ganesh/Temp/StagingArea/bin/classes.dex -v -d
    stdout;
    stderr:
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at SDKMain.main(SDKMain.java:124)
    Caused by: java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
    at UnityApkBuilder.<init>(UnityApkBuilder.java:201)
    at UnityApkBuilder.main(UnityApkBuilder.java:28)
    ... 5 more
     
  2. StaticNova

    StaticNova

    Joined:
    Feb 23, 2013
    Posts:
    60
    That's a keystore issue, either do a development build or make a keystore.
     
  3. LostInTheMachine

    LostInTheMachine

    Joined:
    Aug 8, 2010
    Posts:
    48
    Thanks for your reply, but I don't think so. At least, selecting Development Build yields no success. I'm going to create a keystore now because I have no other option. I did read somehwere that the keystore was only necessary for publishing.
     
  4. LostInTheMachine

    LostInTheMachine

    Joined:
    Aug 8, 2010
    Posts:
    48
    So building after creating a keystore yields the same error. This is really driving me batty!

    Scott
     
  5. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
    It is with Unity 4.
     
  6. anthodb

    anthodb

    Joined:
    Sep 6, 2012
    Posts:
    20
    Hey Scott,

    Did you find a solution to your problem? I do have the same issue here and after reinstalling Unity and the android sdk tools, the problem is still there..
    Don't know where to look at right now..
     
  7. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Hey,
    Your are probably using Android SDK version v22. Unity isn't compatible with this SDk version.
    Downgrade to r21 it ll start work.

    Download Links:
    macosx
    windows

     
  8. anthodb

    anthodb

    Joined:
    Sep 6, 2012
    Posts:
    20
    Hourray ! With r21 it's working great ;)
    Thanks a lot !
     
  9. Waynesaurus

    Waynesaurus

    Joined:
    May 6, 2013
    Posts:
    14
  10. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    I am using v3.5.6. updated to r22. After a lot of research, figured out this incompatibility.
     
  11. RasicETF

    RasicETF

    Joined:
    Aug 9, 2014
    Posts:
    1
    Error building Player: Win32Exception: ApplicationName='C:/Admin desktop/PROGRAMS/Eclipse Android/sdk\tools\zipalign.exe', CommandLine='4 "D:\Unity projects\Android car game\Temp/StagingArea/Package_unaligned.apk" "D:\Unity projects\Android car game\Temp/StagingArea/Package.apk"', CurrentDirectory='Temp/StagingArea'

    This is the same error I think, and I install JDK 32bit and when I see it does not work again I have tried with copying java.exe file from one to other destination but it still does not work.

    Did I miss something ?
     
  12. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    @RasicETF, Google moved the zipalign utility. Compatibility with the latest SDK was added to Unity 4.5.2.
     
  13. youbetterknowme

    youbetterknowme

    Joined:
    Dec 2, 2014
    Posts:
    1
    I am getting these two errors when I build for android using Unity 5:
    .
    E:\Android Sdk\adt-bundle-windows-x86-20140702\sdk\build-tools\22.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "E:/Android Sdk/adt-bundle-windows-x86-20140702/sdk/platforms/android-20\android.jar" -F bin/resources.ap_

    stderr[
    AndroidManifest.xml:4: error: No resource identifier found for attribute 'isGame' in package 'android'

    AndroidManifest.xml:4: error: No resource identifier found for attribute 'banner' in package 'android'

    ]
    stdout[
    Configurations:
    (default)
    ldpi-v4
    hdpi-v4
    xhdpi-v4
    xxhdpi-v4
    xxxhdpi-v4

    Files:
    drawable\app_banner.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    Src: (ldpi-v4) res\drawable-ldpi\app_icon.png
    Src: (hdpi-v4) res\drawable-hdpi\app_icon.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_icon.png
    Src: (xxhdpi-v4) res\drawable-xxhdpi\app_icon.png
    Src: (xxxhdpi-v4) res\drawable-xxxhdpi\app_icon.png
    values\strings.xml
    Src: () res\values\strings.xml
    AndroidManifest.xml
    Src: () AndroidManifest.xml

    Resource Dirs:
    Type drawable
    drawable\app_banner.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    Src: (ldpi-v4) res\drawable-ldpi\app_icon.png
    Src: (hdpi-v4) res\drawable-hdpi\app_icon.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_icon.png
    Src: (xxhdpi-v4) res\drawable-xxhdpi\app_icon.png
    Src: (xxxhdpi-v4) res\drawable-xxxhdpi\app_icon.png
    Type values
    values\strings.xml
    Src: () res\values\strings.xml
    Including resources from package: E:\Android Sdk\adt-bundle-windows-x86-20140702\sdk\platforms\android-20\android.jar
    applyFileOverlay for drawable
    applyFileOverlay for layout
    applyFileOverlay for anim
    applyFileOverlay for animator
    applyFileOverlay for interpolator
    applyFileOverlay for transition
    applyFileOverlay for xml
    applyFileOverlay for raw
    applyFileOverlay for color
    applyFileOverlay for menu
    applyFileOverlay for mipmap
    Processing image: res\drawable-xhdpi\app_banner.png
    Processing image: res\drawable\app_icon.png
    Processing image: res\drawable-ldpi\app_icon.png
    Processing image: res\drawable-hdpi\app_icon.png
    (processed image res\drawable\app_icon.png: 98% size of source)
    (processed image res\drawable-ldpi\app_icon.png: 1Processing image: r07e% size of source)
    s\drawable-xhdpi\app_icon.png
    Processing image: res\drawable-xxhdpi\app_icon.png
    (processed image res\drawable-hdpi\app_icon.png: 83% size of source)
    Processing image: res\drawable-xxxhdpi\app_icon.png
    (processed image res\drawable-xxhdpi\app_icon.png: 66% size of source)
    (processed image res\drawable-xhdpi\app_icon.png: 75% size of source)
    (processed image res\drawable-xxxhdpi\app_icon.png: 61% size of source)
    (processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
    (new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
    (new resource id app_icon from drawable\app_icon.png #generated)
    (new resource id app_icon from ldpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from hdpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from xhdpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from xxhdpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from xxxhdpi-v4\drawable\app_icon.png #generated)
    ]
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[] progress_strings, Single progress_value, System.String errorMsg)
    UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String







    Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    E:\Android Sdk\adt-bundle-windows-x86-20140702\sdk\build-tools\22.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "E:/Android Sdk/adt-bundle-windows-x86-20140702/sdk/platforms/android-20\android.jar" -F bin/resources.ap_

    stderr[
    AndroidManifest.xml:4: error: No resource identifier found for attribute 'isGame' in package 'android'

    AndroidManifest.xml:4: error: No resource identifier found for attribute 'banner' in package 'android'

    ]
    stdout[
    Configurations:
    (default)
    ldpi-v4
    hdpi-v4
    xhdpi-v4
    xxhdpi-v4
    xxxhdpi-v4

    Files:
    drawable\app_banner.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    Src: (ldpi-v4) res\drawable-ldpi\app_icon.png
    Src: (hdpi-v4) res\drawable-hdpi\app_icon.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_icon.png
    Src: (xxhdpi-v4) res\drawable-xxhdpi\app_icon.png
    Src: (xxxhdpi-v4) res\drawable-xxxhdpi\app_icon.png
    values\strings.xml
    Src: () res\values\strings.xml
    AndroidManifest.xml
    Src: () AndroidManifest.xml

    Resource Dirs:
    Type drawable
    drawable\app_banner.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    Src: (ldpi-v4) res\drawable-ldpi\app_icon.png
    Src: (hdpi-v4) res\drawable-hdpi\app_icon.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_icon.png
    Src: (xxhdpi-v4) res\drawable-xxhdpi\app_icon.png
    Src: (xxxhdpi-v4) res\drawable-xxxhdpi\app_icon.png
    Type values
    values\strings.xml
    Src: () res\values\strings.xml
    Including resources from package: E:\Android Sdk\adt-bundle-windows-x86-20140702\sdk\platforms\android-20\android.jar
    applyFileOverlay for drawable
    applyFileOverlay for layout
    applyFileOverlay for anim
    applyFileOverlay for animator
    applyFileOverlay for interpolator
    applyFileOverlay for transition
    applyFileOverlay for xml
    applyFileOverlay for raw
    applyFileOverlay for color
    applyFileOverlay for menu
    applyFileOverlay for mipmap
    Processing image: res\drawable-xhdpi\app_banner.png
    Processing image: res\drawable\app_icon.png
    Processing image: res\drawable-ldpi\app_icon.png
    Processing image: res\drawable-hdpi\app_icon.png
    (processed image res\drawable\app_icon.png: 98% size of source)
    (processed image res\drawable-ldpi\app_icon.png: 1Processing image: r07e% size of source)
    s\drawable-xhdpi\app_icon.png
    Processing image: res\drawable-xxhdpi\app_icon.png
    (processed image res\drawable-hdpi\app_icon.png: 83% size of source)
    Processing image: res\drawable-xxxhdpi\app_icon.png
    (processed image res\drawable-xxhdpi\app_icon.png: 66% size of source)
    (processed image res\drawable-xhdpi\app_icon.png: 75% size of source)
    (processed image res\drawable-xxxhdpi\app_icon.png: 61% size of source)
    (processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
    (new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
    (new resource id app_icon from drawable\app_icon.png #generated)
    (new resource id app_icon from ldpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from hdpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from xhdpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from xxhdpi-v4\drawable\app_icon.png #generated)
    (new resource id app_icon from xxxhdpi-v4\drawable\app_icon.png #generated)
    ]
     
  14. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @youbetterknowme, you are missing sdk platform 21.

    Before you fix your error, could you help us troubleshoot that? Could you post your editor log here? We should warn if no SDK 21 is installed and prompt to update the SDK, so something went wrong in your case.
     
  15. meysamunity

    meysamunity

    Joined:
    Sep 15, 2016
    Posts:
    2
    thank you static nova
     
  16. saadali211

    saadali211

    Joined:
    Feb 17, 2017
    Posts:
    19
    if you are having any problem regarding admob watch this video it saved my life however its in hindi language
    **YouTube Link**