After Implement D8 compiler

BuildServer:
[depend] Deleted 3 out of date files in 0 seconds
[javac] Compiling 2 source files to C:\Users\Admin\appinventor-sources\appinventor\buildserver\build\classes\BuildServer
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:969: error: cannot find symbol
[javac] minSdkForCompilation = minSdk;
[javac] ^
[javac] symbol: variable minSdkForCompilation
[javac] location: class Compiler
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:1412: error: variable tmpDir is already defined in method compile(Project,Set,Map<String,Set>,PrintStream,PrintStream,PrintStream,boolean,boolean,boolean,String,int,String,String,ProgressReporter,boolean)
[javac] File tmpDir = createDir(buildDir, "tmp");
[javac] ^
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:1413: error: variable dexedClassesDir is already defined in method compile(Project,Set,Map<String,Set>,PrintStream,PrintStream,PrintStream,boolean,boolean,boolean,String,int,String,String,ProgressReporter,boolean)
[javac] String dexedClassesDir = tmpDir.getAbsolutePath();
[javac] ^
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:2032: error: cannot find symbol
[javac] for (String name : new TreeSet<>(classes)) {
[javac] ^
[javac] symbol: class TreeSet
[javac] location: class Compiler
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:2091: error: cannot find symbol
[javac] dexTask.setExecutable(getResource(DX_JAR));
[javac] ^
[javac] symbol: variable DX_JAR
[javac] location: class Compiler
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:2106: error: cannot find symbol
[javac] dxTimeMessage = String.format(Locale.getDefault(), "DX time: %f seconds",
[javac] ^
[javac] symbol: variable Locale
[javac] location: class Compiler
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:2171: error: cannot find symbol
[javac] d8Command.add(minSdkForCompilation + "");
[javac] ^
[javac] symbol: variable minSdkForCompilation
[javac] location: class Compiler
[javac] C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java:2174: error: cannot find symbol
[javac] if (minSdkForCompilation < 21) {
[javac] ^
[javac] symbol: variable minSdkForCompilation
[javac] location: class Compiler
[javac] Note: C:\Users\Admin\appinventor-sources\appinventor\buildserver\src\com\google\appinventor\buildserver\Compiler.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 8 errors
[javac] 1 warning

Can anyone help me in this error @pavi2410 Github

1 Like

The errors are due to rebase errors with that branch. Hence, the PR was closed. I am no longer working on that. The reason is because I am exploring a new solution.

Can i try to working on this PR ??

Feel free to do so :slight_smile:

1 Like

Okay i'm working on it

2 Likes

Trying to use java8 for which d8 is a prerequisite,
I made it work with d8, but is is not in a directly releasable/mergeable state right now,
notable changes

  1. in Compiler.java
  • d8 does not take a classes directory but needs a jar
  1. in DexExecute.java
  • d8 command line is different
  • I forced the min-api to 26 as the android apk installer puts less constraints on the dex
  • remove passing the main-dex-list as it is not necessary for api>21

You will see that the code can still be reverted to using dx (through the addition or removal of comments), I am now more and more confident in the reliability of the d8 mode

I did not check any of the corner cases for min-api<26

My sources are here:
https://drive.google.com/drive/folders/1BWKSvSG1nbC3hCU4Dh6ujRd5dyjEed81?usp=sharing

3 Likes

I made a first extension using java 1.8, the extension is using .jar library files compiled with 1.8 that were ususable before.

What I did: on top of modifying the compiler as noted above, on the extensions side:

add lib/appinventor/d8.jar in the extension directory

change build.xml:
--- a/build.xml
+++ b/build.xml
@@ -25,7 +25,7 @@


  • <javac target="7" source="7" destdir="${AndroidRuntime-classes.dir}" srcdir="src" encoding="utf-8"



  • @@ -121,11 +121,11 @@
- <java jar="lib/appinventor/dx.jar" + - - + +
3 Likes

This discussion refers to PR 2034

3 Likes