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

ArrayIndexOutOfBounds Exception after ControlLock #8

Open
franciscorosso opened this issue Jul 8, 2020 · 9 comments
Open

ArrayIndexOutOfBounds Exception after ControlLock #8

franciscorosso opened this issue Jul 8, 2020 · 9 comments

Comments

@franciscorosso
Copy link

Hello everyone,

After using the method controlLock, an exception is thrown that freezes my UI, I dont know how to handle it in order to make my app work. It happens with just few phones.

The error is throwing from the SDK. Here the stacktrace.

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at android.util.SparseArray.keyAt(SparseArray.java:295) at com.ttlock.bl.sdk.api.j.f(Unknown Source:76) at com.ttlock.bl.sdk.api.a$5.run(Unknown Source:1534) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7520) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Thanks in advance,
Francisco.

@indrian16
Copy link

indrian16 commented Jul 18, 2020

The crash occurred on Android 10 ?, if yes we have the same problem

@franciscorosso
Copy link
Author

The crash occurred on Android 10 ?, if yes we have the same problem

Finally I made it work. Set in build.gradle targetSdkVersion 28 and compileSdkVersion 28. It will work for Android 10 too, but in the future TTLock will have to fix it to use sdk 29.

@LCheongYu0316
Copy link

Now that builds targeting SDK 28 are no longer allowed to be uploaded to Play Store, has anyone found a solution or workaround for this while targeting SDK higher than 28?

@franciscorosso
Copy link
Author

franciscorosso commented Nov 19, 2020

Now that builds targeting SDK 28 are no longer allowed to be uploaded to Play Store, has anyone found a solution or workaround for this while targeting SDK higher than 28?

Have you tried updating the version of TTLock? Go to build.gradle and modify it to 3.1.1 and build the project again so it downloads the new version.

https://repo.gradle.org/gradle/repo/com/tongtonglock/ttlock/

There you can see there were new releases of the SDK.

If it works, please let me know!

@LCheongYu0316
Copy link

iirc the same problem happened with TTLock SDK 3.0.6 which worked when I targeted Android SDK 28. My gradle has minifyEnabled, shrinkResources, useProguard set to false. Trying every version between 3.0.6 and 3.1.1 then, doubt anything fruitful will happen.

@franciscorosso
Copy link
Author

franciscorosso commented Nov 19, 2020

I am in the same situation, I have my app without updating just because of this, but I hadn’t tried the new versions of the SDK. I hope they fix it soon.

@LCheongYu0316
Copy link

LCheongYu0316 commented Nov 20, 2020

@franciscorosso Well turns out it was my own problem, because my build process involves [Project JAR] building a .jar file that contains the code that actually practically uses TTLock SDK, then include this .jar into my [Project App] project folder before building. As I haven't been updating dependencies of TTLock SDK and the codes in [Project JAR], the upgrade produced a problem due to different parameters in the interface ControlLockCallback. Due to the setup above it obfuscated the source of error.

TL;DR, TTLock SDK 3.1.1 works while targeting Android SDK 29. Haven't tried Android SDK 30 but I suppose it should be okay.

P.S. can you delete the comment above quoting my error message since I hastily left my package name there. Edit history is public so I will delete mine too after you. Sorry for the trouble.

@franciscorosso
Copy link
Author

@franciscorosso Well turns out it was my own problem, because my build process involves [Project JAR] building a .jar file that contains the code that actually practically uses TTLock SDK, then include this .jar into my [Project App] project folder before building. As I haven't been updating dependencies of TTLock SDK and the codes in [Project JAR], the upgrade produced a problem due to different parameters in the interface ControlLockCallback. Due to the setup above it obfuscated the source of error.

TL;DR, TTLock SDK 3.1.1 works while targeting Android SDK 29. Haven't tried Android SDK 30 but I suppose it should be okay.

P.S. can you delete the comment above quoting my error message since I hastily left my package name there. Edit history is public so I will delete mine too after you. Sorry for the trouble.

Great man! Thanks for sharing the solution.

PS I deleted my previous message. So everything ok.

Greetings,
Francisco

@LCheongYu0316
Copy link

Thanks a lot too.

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

3 participants