Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant App: Exception in thread "main" java.lang.IllegalAccessError: class com.google.android.instantapps.sdk.lib.ClearcutLogger #4

Open
ridvanaltun opened this issue Oct 24, 2024 · 0 comments

Comments

@ridvanaltun
Copy link

I was getting below error when I try run build_run_instant_app.bash file,

Script file:

#!/bin/bash

set -e

adb uninstall com.example || true

# clean
sh scripts/cleanup.bash
./gradlew clean

# build bundle
./gradlew appInstant:bundleRelease

# build apks file from bundle based on connected device configuration
bundletool build-apks --bundle=appInstant/build/outputs/bundle/release/appInstant-release.aab  --output=local_app.apks --connected-device --ks=appInstant/debug.keystore --ks-pass=pass:android --ks-key-alias=androiddebugkey --key-pass=pass:android

# unzipping apks file to testing dir
unzip local_app.apks -d testing_locally

# run instant app from specific split /
ia --debug run testing_locally/instant/*.apk

Error:

Exception in thread "main" java.lang.IllegalAccessError: class com.google.android.instantapps.sdk.lib.ClearcutLogger (in unnamed module @0x15b3f5e7) cannot access class sun.net.www.protocol.https.Handler (in module java.base) because module java.base does not export sun.net.www.protocol.https to unnamed module @0x15b3f5e7
        at com.google.android.instantapps.sdk.lib.ClearcutLogger.<clinit>(ClearcutLogger.java:44)
        at com.google.android.instantapps.sdk.lib.TelemetryManagerImpl.getLoggerForRun(TelemetryManagerImpl.java:139)
        at com.google.android.instantapps.sdk.lib.RunHandlerImpl.runApks(RunHandlerImpl.java:203)
        at com.google.android.instantapps.sdk.cli.RunCommand.call(RunCommand.java:80)
        at com.google.android.instantapps.sdk.cli.RunCommand.call(RunCommand.java:16)
        at picocli.CommandLine.execute(CommandLine.java:830)
        at picocli.CommandLine.access$700(CommandLine.java:111)
        at picocli.CommandLine$RunAll.handleParseResult(CommandLine.java:1024)
        at picocli.CommandLine.parseWithHandlers(CommandLine.java:1100)
        at picocli.CommandLine.parseWithHandler(CommandLine.java:1053)
        at com.google.android.instantapps.sdk.cli.Main.aia(Main.java:89)
        at com.google.android.instantapps.sdk.cli.Main.main(Main.java:76)

I have research the issue and found a solution, add below line to your terminal profile. I'm using zsh so I added to .zshrc, if you use bash, add it to .bashrc:

export JAVA_TOOL_OPTIONS="--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED"

You have to restart your terminal after the change, or you can run below command to change take effect:

# for zsh
source ~/.zshrc

# for bash
source ~/.bashrc

I have open this issue only for documentation,
I hope it helps someone

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

No branches or pull requests

1 participant