I wish to port a small utility I prototyped on Windows as a simple app. I use a 10-year old computer, so from what I gather tools like Gradle and Android Studio would run too slow for me to be able to meaningfully iterate fast. I also know nothing about Android app structure, so seeing the different stages of compilation by compiling from command line is instructive anyway.
I'll list the stages I've been through and then my current error, as I've no idea if my setup or some earlier stage might be causing the issue. I am getting errors trying to compile an example app.
I am following this tutorial : https://hereket.com/posts/android_from_command_line/(I installed build/platform tools and an image for v28.0.3 and have JDK 22).
The differences I've had are :1- aapt wouldn't run if the gen folder wasn't explicitely created beforehand2- d8 refused a *.class parameter, so I've generated the file list manually.
I worked around the issue mentioned here : Error while running dx or d8 tool for Android in the same fashion.
d8 currently gives me the following error :
java.lang.IllegalArgumentException at com.android.tools.r8.org.objectweb.asm.ClassReader.<init>(ClassReader.java:160) at com.android.tools.r8.org.objectweb.asm.ClassReader.<init>(ClassReader.java:143) at com.android.tools.r8.org.objectweb.asm.ClassReader.<init>(ClassReader.java:418) at com.android.tools.r8.graph.JarClassFileReader.read(JarClassFileReader.java:66) at com.android.tools.r8.dex.ApplicationReader$ClassReader.lambda$readClassSources$1(ApplicationReader.java:231) at java.base/java.util.concurrent.ForkJoinTask$AdaptedInterruptibleCallable.compute(ForkJoinTask.java:1689) at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1641) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
Input command is this :
d8 --debug --output __build\apk\my_classes.jar --no-desugaring __build\obj\com\user\android_build_test\MainActivity.class \obj\com\user\android_build_test\R$attr.class __build\obj\com\user\android_build_test\R$id.class __build\obj\com\user\android_build_test\R$layout.class __build\obj\com\user\android_build_test\R$style.class __build\obj\com\user\android_build_test\R.class
The only difference being I give it an absolute path.If I instead remove all files except one with path removed, I obtain :
Error in R.class: Error with input file: R.classCompilation failed(etc. - same call stack)
Any idea what causes this ? If so, any idea how I could have worked it out without what seems to be a considerable amount of implicit knowledge ?