Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a build apk button #3

Open
gummywormz opened this issue Oct 20, 2014 · 7 comments
Open

Add a build apk button #3

gummywormz opened this issue Oct 20, 2014 · 7 comments
Assignees
Milestone

Comments

@gummywormz
Copy link
Owner

You should probably put a new window for console output though...

@gummywormz gummywormz self-assigned this Oct 20, 2014
@gummywormz gummywormz modified the milestone: 2.0 Oct 20, 2014
@gummywormz
Copy link
Owner Author

http://developer.android.com/tools/building/building-cmdline.html

Looks like you need to use ant / steal that script.

@gummywormz
Copy link
Owner Author

@gummywormz
Copy link
Owner Author

@gummywormz
Copy link
Owner Author

We've done it, somehow. Here are the commands for dexing files and also building APKs. It's ridiculous that I had to go digging in the anttasks source to find these.

Dex: SDK_DIRECTORY/build-tools/20.0.0/lib/dx.jar
--dex
--verbose
--output=PROJECT/bin/classes.dex
PROJECT/bin/classes/
PROJECT/libs

NOTE: dx.bat / the dx script is just findjava, and passes any parameters as well as -Xmx1024M for heap size stuffs

AAPT: SDK_DIRECTORY/build-tools/20.0.0/aapt
package
--auto-add-overlay
-v
-f
-M PROJECT/AndroidManifest.xml
-A PROJECT/assets
-S PROJECT/res
-S library/res
-I SDK_DIRECTORY/platforms/android-7/android.jar
-F DEV_HOME/bin/AndroidTest.unsigned.apk

P.S. That test apk outputted doesn't run. Check if you need to sign it or include -A or something.

@gummywormz
Copy link
Owner Author

Update:

Dex:
ANDROID_HOME/build-tools/20.0.0/dx --dex --verbose --output PROJECT/bin/classes.dex PROJECT/bin/dexedLibs (if exists, PROJECT/libs AND library/libs otherwise) PROJECT/bin/classes/

aapt: aapt p -v -f -M PROJECT/AndroidManifest.xml -A PROJECT/assets -S PROJECT/res -I SDK_DIRECTORY/platforms/android-7/android.jar -F PROJECT/bin/AndroidTest.unsigned.apk (-S library/res too if first time)

Then you must add classes.dex to the apk file. I suggest doing it manually via zipfile stuff.

More testing still needs to be done on this before coding can really begin.

@gummywormz
Copy link
Owner Author

The above works for apks that were already generated by Eclipse. Dex is the same, but avoid adding duplicate libraries. aapt must add all library's res if it was not generated by eclipse, along with --auto-add-overlay.

@gummywormz
Copy link
Owner Author

For an idea on avoiding adding duplicate libraries: Create a LibraryFile class. This holds a File object + the hash of the file. Make an arraylist of these objects temporarily Override .equals to compare hash only, and transfer to a new arraylist (use contains).

for (T element : original) {
if (!uniques.contains(element)) {
uniques.add(element);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant