As of build tools 24.0.0-rc2 and gradle plugin 2.1.0-alpha3, I'm now seeing 
that the Gradle task is failing as expected, but still doesn't explain why 
jack can't compile the code.  The error implies that there's a class in the 
inheritance hierarchy that can't be found, but running with --debug, I 
can't see what is missing.

@Xav, is there any way I can help debug this?  How can I track down which 
jayce file is missing?

On Wednesday, February 3, 2016 at 6:13:48 PM UTC-5, Joe Hansche wrote:
>
> In looking further into this, it seems that it may be caused by a library 
> project not compiling properly, or not getting added to the jack/jill build 
> cycle.
>
> Running the gradle task with --debug, I spotted this warning in the log 
> output while running the "jack" command:
>
> 16:50:27.725 [INFO] [org.gradle.process.internal.DefaultExecHandle] 
> Starting process 'command 
> '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java''. 
> Working directory: git/workspace Command: 
> /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java 
> -Djava.awt.headless=true -Xmx4G -Dfile.encoding=UTF-8 -Duser.country=US 
> -Duser.language=en -Duser.variant -cp /sdk/build-tools/23.0.2/jack.jar 
> com.android.jack.Main --verbose debug --classpath 
> build/intermediates/jill/jack/debug/runtime/android-ced512afb3dcf31a4e2d4ff40214332afd20b01d.jar
>  
> --import build/intermediates/jill/jack/debug/packaged/... --import ... 
> <SNIP>
> 16:50:34.164 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] 
> Process 'command 
> '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' 
> *finished with exit value 4 (state: FAILED)*
> 16:50:34.173* [QUIET] [system.out] Warning: Exception while processing 
> task* java.io.IOException: 
> com.android.ide.common.process.ProcessException: 
> org.gradle.process.internal.ExecException: Process 'command 
> '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' 
> finished with non-zero exit value 4
>
> So the jack command is failing with exit code 4, but that failure is never 
> bubbling back out to the Gradle build process.  The gradle build just 
> continues on as if the Jack process succeeded.  Because it failed, there 
> will be no dex files generated by Jack, and that's why classes*.dex are all 
> missing from the APK.
>
>
> So I extracted the "java -jar jack.jar ..." command from the gradle log, 
> and tried running it manually, and I got almost 4000 lines of JSON output. 
>  When I change "--verbose debug" to "--verbose error", I still get 2500 
> lines of JSON output.
>
> The Jack errors are reporting things like:
>
> MESSAGE:{"kind":"ERROR","text":"The hierarchy of the type 
> MyContentFragment is 
> inconsistent","sources":[{"file":"src\/main\/java\/path\/to\/MyContentFragment.java","position":{"startLine":45,"startColumn":-1,"startOffset":-1,"endLine":45,"endColumn":-1,"endOffset":-1}}]}
>
> But it doesn't explain why that hierarchy is inconsistent.  The only thing 
> I could think of was that android.support.v4.app.Fragment maybe couldn't be 
> found, but I did find the jar file that contains that jayce file, and it is 
> already included in the --import entries.
>
> At this point I'm not sure how else to proceed.  The jack tool does not 
> seem to be reporting any usable errors to help track down what is happening.
>
> I'll try to recreate a simplified test case to prove the above theory.
>
> On Wednesday, February 3, 2016 at 4:41:15 PM UTC-5, Joe Hansche wrote:
>>
>> Test is basically:
>>
>>  productFlavors {
>>         javac {
>>             useJack false
>>         }
>>         jack {
>>             useJack true
>>         }
>>     }
>>
>> $ ./gradlew :assembleJavacDebug :assembleJackDebug
>>
>> $ ls -l build/outputs/apk/ | grep -v unaligned
>> total 443000
>> -rw-r--r--+ 1 jhansche  staff  30074468 Feb  3 16:31 App-javac-debug.apk
>> -rw-r--r--+ 1 jhansche  staff  21634256 Feb  3 16:32 App-jack-debug.apk
>>
>> Notice the size difference is  almost 10 MB.  Checking the contents of 
>> the compiled APKs shows that javac contains 3 (multidex) dex files:
>>
>> $ unzip -l build/outputs/apk/App-javac-debug.apk | grep dex
>>   8870148  02-03-16 16:31   classes.dex
>>   9338456  02-03-16 16:31   classes2.dex
>>   1275928  02-03-16 16:31   classes3.dex
>>
>> while the Jack version contains 0 dex files:
>>
>> $ unzip -l build/outputs/apk/App-jack-debug.apk | grep dex
>> $ unzip -l build/outputs/apk/App-jack-debug.apk | grep -c dex
>> 0
>>
>>
>> Running  `find build -name '*.dex'` also shows only the dex files that go 
>> into the "Javac" flavor -- no files attributed to the "Jack" flavor.
>>
>> On Wednesday, February 3, 2016 at 4:35:15 PM UTC-5, Joe Hansche wrote:
>>>
>>> Using 2.0 preview 9 and gradle plugin 2.0.0-alpha9, building with 
>>> useJack true, I'm still seeing no classes.dex added in the APK.  Was this a 
>>> regression?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to