spoon: java.lang.ArrayIndexOutOfBoundsException when using gradle plugin 3.0.0.x

When trying to use Spoon with the latest build tools / gradle plugin, the spooner-runner crashes when attempting to analyze the AndroidManifest of the test app:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 96
	at com.squareup.spoon.internal.thirdparty.axmlparser.StringBlock.getShort(StringBlock.java:255)
	at com.squareup.spoon.internal.thirdparty.axmlparser.StringBlock.getRaw(StringBlock.java:110)
	at com.squareup.spoon.internal.thirdparty.axmlparser.StringBlock.read(StringBlock.java:77)
	at com.squareup.spoon.internal.thirdparty.axmlparser.AXMLParser.doStart(AXMLParser.java:201)
	at com.squareup.spoon.internal.thirdparty.axmlparser.AXMLParser.<init>(AXMLParser.java:48)
	at com.squareup.spoon.SpoonInstrumentationInfo.parseFromFile(SpoonInstrumentationInfo.java:62)
	at com.squareup.spoon.SpoonRunner.run(SpoonRunner.java:115)
	at com.squareup.spoon.Main.main(main.kt:35)

Maybe the AXML format has changed?

When using the Android Studio APK analyzer, the Manifest looks fine.

I reproduce using the master branch built locally. I added some log to try to figure out what is wrong. It’s hard to say what the problem is. The length returned at line 95 of StringBlock (1285) seems way too big for my string blocks. m_strings contains only 96 entries. Hence the crash when attempting to get the 96th entry.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 8
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Could you please let me know when we can expect the final jar?

Yeah the URL in the README is the one you’d add to your repositories{} block in Gradle.

On Thu, Oct 26, 2017 at 4:32 PM Sam Edwards notifications@github.com wrote:

Thanks @JakeWharton https://github.com/jakewharton!

For those too lazy to browse to it: https://oss.sonatype.org/content/repositories/snapshots/com/squareup/spoon/spoon-runner/2.0.0-SNAPSHOT/

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/square/spoon/issues/461#issuecomment-339723795, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEETQ5bgI6_zkQ02lyABmZfwUa2jtYks5swLQCgaJpZM4N3qWA .

The readme has a pointer to the snapshots Maven repo: https://github.com/square/spoon/#download

On Thu, Oct 26, 2017 at 4:20 PM Sam Edwards notifications@github.com wrote:

I’ve verified this is fixed in 2.0.0-SNAPSHOT if you build from source. Note: A ton of command-line arguments have changed so see CliArgs.kt in the spoon-runner lib for details.

Also note: installDebug as mentioned above won’t work for the spoon-runner lib. You’ll have to run install to get it to compile.

Are there any plans to expose the 2.0.0-SNAPSHOT publicly without having to build from source?

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/spoon/issues/461#issuecomment-339720457, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEERyM_AkfrNjh5JJy_sqecNm9y9o_ks5swLFogaJpZM4N3qWA .

This is output from the spoon-runner jar referenced in the main README under “Execution”: https://search.maven.org/remote_content?g=com.squareup.spoon&a=spoon-runner&v=LATEST&c=jar-with-dependencies