Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Android build fails (bad descriptor: Lpython/__phello__.foo) #944

Open
MatBonv opened this issue Apr 8, 2019 · 6 comments
Open

Android build fails (bad descriptor: Lpython/__phello__.foo) #944

MatBonv opened this issue Apr 8, 2019 · 6 comments

Comments

@MatBonv
Copy link

MatBonv commented Apr 8, 2019

When I try to build the android app of hello world, this error occures:

Writing build/intermediates/classes/debug\python\travertino/__init__.class ...
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexForDebug
Dex: Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
    UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
  at com.android.dx.command.dexer.Main.processClass(Main.java:775)
       at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741)
   at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
 at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
   at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
       at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
  at com.android.dx.command.dexer.Main.processOne(Main.java:695)
 at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
 at com.android.dx.command.dexer.Main.run(Main.java:292)
        at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
    at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
     at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.dx.cf.iface.ParseException: bad descriptor: Lpython/__phello__.foo;
    at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:347)
        at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)
 at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
      at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
       at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)
   at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
     at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
 at com.android.dx.command.dexer.Main.parseClass(Main.java:787)
 at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
 at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722)
      at com.android.dx.command.dexer.Main.processClass(Main.java:773)
       ... 16 more
Caused by: java.lang.IllegalArgumentException: bad descriptor: Lpython/__phello__.foo;
     at com.android.dx.rop.type.Type.intern(Type.java:356)
  at com.android.dx.rop.type.Type.internClassName(Type.java:420)
 at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:289)
        ... 27 more

1 error; aborting
:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I tried to use python setup.py android --support-pkg https://pybee-briefcase-support.s3-us-west-2.amazonaws.com/Python-Android-support/3.5/Android/Python-3.5-Android-support.b5.tar.gz --build --start as a workaround (mentioned in #708) but it gives the same error. Any help is welcome.

@freakboy3742
Copy link
Member

The underlying problem is that VOC is currently generating invalid bytecode for one of the data structures contained in travertino.

If you use a stable version of Toga (i.e., 0.2.15) and the old build of Android-support, you should have more luck; but the development branch of Toga isn't compatible with VOC at this time.

@MatBonv
Copy link
Author

MatBonv commented Apr 9, 2019

Alright, thanks for answering.
But how do I use an other version of Toga? It will automatically collect the latest version.

@freakboy3742
Copy link
Member

If you look at the setup.py file for your project (the one generated by build new), it will list toga as a dependency, specifying a version of "==0.3.0.dev11" in a couple of places (one for the core, and for each platform, too). If you change that to "==0.2.15", you'll get a different version.

@MatBonv
Copy link
Author

MatBonv commented Apr 10, 2019

Ok thanks, so I changed the version to 0.2.15 and ran python setup.py android --support-pkg https://pybee-briefcase-support.s3-us-west-2.amazonaws.com/Python-Android-support/3.5/Android/Python-3.5-Android-support.b5.tar.gz --build --start (also tried b3, b4 and b6), but the same error occures...

@dboddie
Copy link
Contributor

dboddie commented Jun 30, 2019

The __phello__.foo module also needs to be excluded from the Ouroboros build - see #956.

@dboddie
Copy link
Contributor

dboddie commented Jul 16, 2019

Jeff Smith @whydoubt points out in this message, the period in __phello__.foo makes it an invalid class name.

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

No branches or pull requests

3 participants