
If you have the error UNEXPECTED TOP-LEVEL EXCEPTION, it can be because you use old build tools and DX try to translate java 1.7 rather than 1.8. dx -dex -output=$PROJ/bin/x $PROJ/*.jar $PROJ/obj dx -dex -output=$PROJ/bin/x $PROJ/objīut if you use external libraries, do rather. We have to translate them in a file called “x” which will be read by the dalvik Android runtime: cd /opt/android-sdk/build-tools/26.0.1/. class files are in obj folder, but Android can’t read them. If you have use an external, add it the classpath: javac -d obj -classpath "src:libs/.jar" -bootclasspath /opt/android-sdk/platforms/android-19/android.jar src/com/example/helloandroid/*.java java files: cd /path/to/AndroidHello javac -d obj -classpath src -bootclasspath /opt/android-sdk/platforms/android-19/android.jar src/com/example/helloandroid/*.java

You can find yours in a location like android-sdk/platforms/android-/android.jar


Now, I recommend to store the project path in a variable: export PROJ=path/to/HelloAndroidįirst, we need generate the R.java file which is necessary for our code: cd /opt/android-sdk/build-tools/26.0.1/.
