ewpatton / appinventor-sources

MIT App Inventor Public Open Source
http://appinventor.mit.edu/appinventor-sources/
Apache License 2.0
9 stars 7 forks source link

Unable to create .apk #11

Open behrouzbk opened 6 years ago

behrouzbk commented 6 years ago

It seems that with target sdk 26, there are some additional libraries that need to be installed to support the apk generation. What type of operating system is being used for your buildserver and do you know what libraries should be installed? The apk can properly build on Windows box, but fails on Linux. The error message is:

BuildServer build INFO: Build output: __Creating fragment xml __Generating manifest file __Attaching native libraries __Attaching Android Archive (AAR) libraries __Attaching component assets __Invoking AAPT YAIL compiler - AAPT execution failed.

behrouzbk commented 6 years ago

@ewpatton kindly help

ewpatton commented 6 years ago

Please provide some more details:

  1. Is there an issue with starting the build server?
  2. Is there an issue when compiling the app after the build server is running?
  3. What error message do you get if any when trying to run aapt under lib/android directly from the command line?

On Jul 18, 2018, at 07:15, Bruce Kashani notifications@github.com wrote:

It seems that with target sdk 26, there are some additional libraries that need to be installed to support the apk generation. What type of operating system is being used for your build server and do you know what libraries should be installed?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

behrouzbk commented 6 years ago

@ewpatton Thank you for your reply, these are details as you asked:

  1. Is there an issue with starting the build server? No, it starts up properly

  2. Is there an issue when compiling the app after the build server is running? Error occurs when request is sent to build .apk The error message is triggered when executing aapt (compiler - statements below) aaptPackageCommandLineArgs.add(libsDir.getAbsolutePath()); String[] aaptPackageCommandLine = aaptPackageCommandLineArgs.toArray(new String[aaptPackageCommandLineArgs.size()]);

    long startAapt = System.currentTimeMillis(); // Using System.err and System.out on purpose. Don't want to pollute build messages with // tools output if (!Execution.execute(null, aaptPackageCommandLine, System.out, System.err)) { LOG.warning("YAIL compiler - AAPT execution failed."); err.println("YAIL compiler - AAPT execution failed."); userErrors.print(String.format(ERROR_IN_STAGE, "AAPT")); return false; }

  3. What error message do you get if any when trying to run aapt under lib/Android directly from the command line?

Notice that this works on windows box with no problem

Questions:

screenshot

Amerkashi commented 6 years ago

@ewpatton I think the issue is because android.jar is changed to version 26 and aapt doesn't seem to be compatible?? Is there anyway to print-out the full aaptpackage line arg so that we (@behrouzbk is on my team) can directly run the aapt?

Also, can you tell us your buildserver spec and if you are able to build sucessfully with your updated android.jar? Thanks

behrouzbk commented 6 years ago

@ewpatton The commands are generated like below. It seems like the files get removed from temp folder afterwards. 1> What can be done to keep the files, 2> somehow we are getting .. instead of full path. Is there anyway to get full path? /tmp/aapt5683090362542167183 package -v -f -M /tmp/1531936030896_0.34705431695054223-0/youngandroidproject/../build/AndroidManifest.xml -S /tmp/1531936030896_0.34705431695054223-0/youngandroidproject/../build/intermediates/res/merged -A /tmp/1531936030896_0.34705431695054223-0/youngandroidproject/../assets -I /tmp/android7884080764813100175.jar -F /tmp/15319360308960.34705431695054223-0/youngandroidproject/../build/deploy/test1.ap -m -J /tmp/1531936030896_0.34705431695054223-0/youngandroidproject/../build/generated/src --custom-package com.appybuilder.bkashani.test1 --output-text-symbols /tmp/1531936030896_0.34705431695054223-0/youngandroidproject/../build/generated/symbols /tmp/1531936030896_0.34705431695054223-0/youngandroidproject/../build/libs

ewpatton commented 6 years ago

If you are running on a 64 bit Linux, you may need to install additional packages. I just went through the process of setting up an Ubuntu Xenial VM from scratch and needed to install lib32z1 and lib32stdc++6 for aapt. With those installed, I was able to generate APKs.

In response to @behrouzbk's two questions:

1) Preventing the deletion of build data isn't a configurable thing, but you can hack it by: a) Comment out the code in BuildServer.cleanUp() b) Comment out the call to FileUtils.deleteQuietly at ProjectBuilder.java:192 c) If the Companion APK is failing to build with the ant PlayApp command, you may also want to comment out the call to file.deleteOnExit() at Compiler.java:1761 otherwise the files are deleted when the build process exits. 2) The .. are intentional and indicate that the path is relative to the parent of the directory. They are not an ellipsis

Amerkashi commented 6 years ago

hmm. Interesting. For Execution.execute, we are getting Process waitFor result of 139 instead of 0. I guess we need to dig into it to see what is causing this (we have updates on top of your code)

ewpatton commented 6 years ago

@Amerkashi If you comment out the things I mention in my previous post, the files should hang around after the build so you can manually run the AAPT command line logged by App Inventor.