Search Unity

Android Builder Tool

Discussion in 'Android' started by zalogic, Mar 23, 2012.

  1. mattbenic

    mattbenic

    Joined:
    Nov 24, 2010
    Posts:
    38
    If Unity Basic still doesn't allow native plugins, then Floky's original version won't work for you, however the one I posted above should work just fine. IIRC I removed the plugin usage entirely. You should be able to build and sign your Android build as normal, and then just run the splitter with the appropriate settings.
     
  2. annaharris

    annaharris

    Joined:
    Apr 5, 2013
    Posts:
    27
    Nice work Floky..I am feeling very glad to see this post. I am looking for next updated version. Thanks a lot for sharing this valuable post.
     
  3. sobek

    sobek

    Joined:
    Jul 29, 2012
    Posts:
    44
    This looks like an awsome tool. Really great work!

    But I dont understand the readme file.
    Which file is "the installer template project"? is it the UnityInstaller folder?
    To import the folder in eclipse I press: File/Import/General/ Excisting project into workspace . Press NEXT and then select the UnityInstaller folder.
    I Then get this error message in the console "[2013-06-10 21:45:21 - Installer] Unable to resolve target 'android-15'"

    I am using windows 7.

    Can anyone please help me?
     
  4. mattbenic

    mattbenic

    Joined:
    Nov 24, 2010
    Posts:
    38
    This means you don't have the specific version of the android SDK it's asking for. You need to open the Android SDK updater (from Eclipse, not directly from your SDK folder, they use different version information for some stupid reason) and choose to download the SDK version matching the error you're seeing.
     
  5. pedroathumanspot

    pedroathumanspot

    Joined:
    Oct 30, 2012
    Posts:
    9
    Hi Matt,

    I followed the instructions you've put up on Github but when I run my app it crashes and shows a "Unfortunately, YOUR APP NAME HERE has stopped." error. (Yes I din't bother to change installer_app_name string, yet.) The logcat outputs the following RuntimeException:

    E/AndroidRuntime( 7870): FATAL EXCEPTION: main
    E/AndroidRuntime( 7870): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.yourdomain.yourapp/com.yourdomain.yourapp.YourAppDownloaderActivity}: java.lang.ClassNotFoundException: Didn't find class "com.yourdomain.yourapp.YourAppDownloaderActivity" on path: /data/app/com.yourdomain.yourapp-2.apk
    E/AndroidRuntime( 7870): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
    E/AndroidRuntime( 7870): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
    E/AndroidRuntime( 7870): at android.app.ActivityThread.access$600(ActivityThread.java:141)
    E/AndroidRuntime( 7870): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
    E/AndroidRuntime( 7870): at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime( 7870): at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime( 7870): at android.app.ActivityThread.main(ActivityThread.java:5039)
    E/AndroidRuntime( 7870): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime( 7870): at java.lang.reflect.Method.invoke(Method.java:511)
    E/AndroidRuntime( 7870): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    E/AndroidRuntime( 7870): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    E/AndroidRuntime( 7870): at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime( 7870): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.yourdomain.yourapp.YourAppDownloaderActivity" on path: /data/app/com.yourdomain.yourapp-2.apk
    E/AndroidRuntime( 7870): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
    E/AndroidRuntime( 7870): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    E/AndroidRuntime( 7870): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    E/AndroidRuntime( 7870): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
    E/AndroidRuntime( 7870): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
    E/AndroidRuntime( 7870): ... 11 more


    Which doesn't makes alot of sense to me. I've already changed the package names properly, as you state on step 7, but the installer is firing the com.yourdomain.yourapp.YourAppDownloaderActivity.

    Any idea of what may be happening here?

    Cheers. Thanks in advance.
     
  6. mattbenic

    mattbenic

    Joined:
    Nov 24, 2010
    Posts:
    38
  7. pedroathumanspot

    pedroathumanspot

    Joined:
    Oct 30, 2012
    Posts:
    9
    Hi Matt, thanks for the reply.

    Yes, I did changed all the references from "com.yourdomain.yourapp" to my package name/domain/etc on the source files aswell as the manifest - just double checked. I also incremented the version code, yes. :/

    Cheers.
     
  8. ATMEthan

    ATMEthan

    Joined:
    Dec 27, 2012
    Posts:
    54
    Hey all,

    I'm stuck in a position where I have to use Unity3 and now my apks are over 50mbs.

    So, I went through this whole thread learning how to use this tool. Then I took a crack at it, it took me about 2 trys to set it up correctly, mainly because I was changing the namespace of the package under Gen incorrectly. But I figured that out and I was so excited to see my game build but then it stopped building. Or rather it was finished building and gave me 1 apk like it usually would. It didn't do any splitting of any sorts, it just skipped the whole thing.

    So where did I go wrong? How do I get this jar file to execute after the building is complete? I thought I just build the jar file from extracting the src folder in the project, then drop it in the Plugins/Android folder and bam magic happens and I get two apks. Clearly I was wrong.

    I'll eventually scan this thread again and the older one to see if someone ran into this problem as well.

    If any files are needed to further research my issue please let me know and I can email the files to you.

    But please any advice is a great help!!!

    -Ethan

    Update 1: Ok I totally overlooked one step which was causing nothing to happen when building for android. DO NOT forget to copy the contents of "InstallerAndroidBuilder/Builds/" into your project's editor folder. Totally messed that up. So now I finally got it to run and something went wrong. Here is my error log its in regard to generating a dex file.

    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.RuntimeException: Temp/StagingArea/plugins: file not found
    at com.android.dx.util.FileUtils.readFile(FileUtils.java:55)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:134)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
    at com.android.dx.command.dexer.Main.processOne(Main.java:422)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
    at com.android.dx.command.dexer.Main.run(Main.java:209)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)
    1 error; aborting
    Error while trying to generate DEX file!
    Error! Android Builder failed in Step 4: generateDexFile()

    I will continue with this endeavor and debugging this error, but please any help is well appreciated. I will post updates if I overcome this error, if not I will rot and die trying.

    Update 2: I have no idea why that error above occured once, but I redownloading the files from the first page and redid the whole process and it worked. But my downloader part of the project was broken. My first was an issue with how I was re-naming the /gen packages in the eclipse project. I was right-clicking on the /gen/com.whatever.packageName and hit refactor and set the name like that. THIS IS WRONG... idk why I thought that was the way to do it, I suppose I just confused myself reading the READMEs and the two instruction sets(one on page 4 or 3 and the mattbenic one in the link 1 post above me.) Once I figured out how to correctly rename the bundle id (just do it in the androidmanifest and the gen will update itselfs, IF everything is correct in your project). Then after I successfully exported my Jar file ofc my unity and its link to android broken. Upon building the apk in unity(not the in split apker) I was getting an error - unknown. But this doesn't concern the Android Tool, this just happened b/c I was messing around with the android sdk files too much and I messed something up myself. So I re-installed the whole android sdk and it built fine. Then there was one more error in my way. My url, I was returning the wrong url which caused nothing to download but the installer still thought it downloaded something and switched it out with nothing. So what was happening was everytime I played the app after the broken installation i just crashed. My error was in the two methods we have to write. In getGameDataUrl() I was returning the full game url when you are just suppose to return the url that contains the apk(s). And in getRemoteGameDataApkFilename() I was returning the gameData apk name. So in the end my url looked something like http://mydomain.com/apkLocations/apkName.apkapkName.apk which is clearly wrong. But once I fixed that it worked beautifully!!!

    I am now graduated and in the alumni of Successful Unity Split Apkers!!!! Woot Woot!

    Thanks FLOKY!!!!!
     
    Last edited: Aug 29, 2013
  9. musoufan91

    musoufan91

    Joined:
    Nov 27, 2012
    Posts:
    8
    I keep getting this error and I don't know what to do. I Feel like I have followed all the instructions.


    Unity Android SDK Root Path hasn't been set! The build process can't continue!!!
    Quit, setup Unity Android Sdk root path, make sure you have the latest Android API installed and try building again.
    Error in execCmd(...) trying to execute command: aapt
    Cannot run program "aapt": error=2, No such file or directory
    Error in execCmd(...) trying to execute command: aapt
    Cannot run program "aapt": error=2, No such file or directory
    Error in execCmd(...) trying to execute command: aapt
    Cannot run program "aapt": error=2, No such file or directory
    Unexpected error in generateAndCompileRClass():
    null
    Error! Android Builder failed in Step 3: generateAndCompileRClass()
     
  10. alfchee

    alfchee

    Joined:
    Jun 14, 2012
    Posts:
    19
    Hi!! I follow using the Unity 3.5.7 and I use the initial Android Builder Tool and have a problem when I put the AndroidManifest.xml in the Plugin/Android folder. The error is:
    ailed to re-package resources with the following parameters:
    package -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/user/Documents/SDK/android-sdk-macosx/platforms/android-16/android.jar" -F bin/resources.ap_
    Configurations:
    (default)
    hdpi
    ldpi
    xhdpi

    Files:
    drawable/app_icon.png
    Src: () res/drawable/app_icon.png
    Src: (hdpi) res/drawable-hdpi/app_icon.png
    Src: (ldpi) res/drawable-ldpi/app_icon.png
    Src: (xhdpi) res/drawable-xhdpi/app_icon.png
    values/strings.xml
    Src: () res/values/strings.xml
    AndroidManifest.xml
    Src: () AndroidManifest.xml

    Resource Dirs:
    Type drawable
    drawable/app_icon.png
    Src: () res/drawable/app_icon.png
    Src: (hdpi) res/drawable-hdpi/app_icon.png
    Src: (ldpi) res/drawable-ldpi/app_icon.png
    Src: (xhdpi) res/drawable-xhdpi/app_icon.png
    Type values
    values/strings.xml
    Src: () res/values/strings.xml
    Including resources from package: /Users/user/Documents/SDK/android-sdk-macosx/platforms/android-16/android.jar
    applyFileOverlay for drawable
    applyFileOverlay for layout
    applyFileOverlay for anim
    applyFileOverlay for animator
    applyFileOverlay for interpolator
    applyFileOverlay for xml
    applyFileOverlay for raw
    applyFileOverlay for color
    applyFileOverlay for menu
    applyFileOverlay for mipmap
    Processing image: res/drawable/app_icon.png
    Processing image: res/drawable-hdpi/app_icon.png
    (processed image res/drawable/app_icon.png: 84% size of source)
    Processing image: res/drawable-ldpi/app_icon.png
    (processed image res/drawable-ldpi/app_icon.png: 90% size of source)
    Processing image: res/drawable-xhdpi/app_icon.png
    (processed image res/drawable-hdpi/app_icon.png: 80% size of source)
    (processed image res/drawable-xhdpi/app_icon.png: 75% size of source)
    (new resource id app_icon from drawable/app_icon.png #generated)
    (new resource id app_icon from hdpi/drawable/app_icon.png #generated)
    (new resource id app_icon from ldpi/drawable/app_icon.png #generated)
    (new resource id app_icon from xhdpi/drawable/app_icon.png #generated)
    AndroidManifest.xml:23: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/icon').
    AndroidManifest.xml:23: error: Error: No resource found that matches the given name (at 'label' with value '@string/installer_app_name').

    UnityEngine.Debug:LogError(Object)
    PostProcessAndroidPlayer:postProcessInternal(BuildTarget, String, String, String, String, String, String, BuildOptions)
    PostProcessAndroidPlayer:postProcess(BuildTarget, String, String, String, String, String, String, BuildOptions)
    UnityEditor.HostView:OnGUI()
     
  11. alfchee

    alfchee

    Joined:
    Jun 14, 2012
    Posts:
    19
    By other hand, if I don't add the AndroidManifest.xml the tool works in the proper way. But after the installation in the device the app just crash, and give me another kind of errors:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myhost.mygame/com.unity3d.player.UnityPlayerNativeActivity}: java.lang.RuntimeException: unable to link / load_library[1149]: Library '/assets/libs/armeabi-v7a/libmono.so' not found
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2079)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
    at android.app.ActivityThread.access$600(ActivityThread.java:132)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4575)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.RuntimeException: unable to link / load_library[1149]: Library '/assets/libs/armeabi-v7a/libmono.so' not found
    at java.lang.Runtime.nativeLoad(Native Method)
    at java.lang.Runtime.loadLibrary(Runtime.java:368)
    at java.lang.System.loadLibrary(System.java:535)
    at com.unity3d.player.UnityPlayer.<init>(Unknown Source)
    at com.unity3d.player.UnityPlayerNativeActivity.onCreate(Unknown Source)
    at android.app.Activity.performCreate(Activity.java:4465)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2033)
    ... 11 more

    What can I do to solve this problem? or what I'm doing wrong?
    Thanks!