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

App crash with java.lang.ClassNotFoundException #2

Closed
code-with-max opened this issue Dec 13, 2023 · 13 comments
Closed

App crash with java.lang.ClassNotFoundException #2

code-with-max opened this issue Dec 13, 2023 · 13 comments

Comments

@code-with-max
Copy link

code-with-max commented Dec 13, 2023

Hello.
App died with java.lang.ClassNotFoundException when I used this template.

2-13 11:28:55.970  5464  5464 F DEBUG   : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.GoogleApiAvailability" on path: DexPathList[[zip file "/data/app/~~5i67fVLY5Ef9yC4AfWCKlw==/org.godotengine.classicsnake-ZMW6o20AcigpqLXz7bibYQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~5i67fVLY5Ef9yC4AfWCKlw==/org.godotengine.classicsnake-ZMW6o20AcigpqLXz7bibYQ==/lib/x86_64, /data/app/~~5i67fVLY5Ef9yC4AfWCKlw==/org.godotengine.classicsnake-ZMW6o20AcigpqLXz7bibYQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]

It`s crashed with any imported classes, not only GoogleApiAvailability, also task.Task and others.

import com.google.android.gms.common.GoogleApiAvailability
import com.google.android.gms.tasks.*

upd:
godotengine/godot#86152

@code-with-max code-with-max changed the title java.lang.ClassNotFoundException App crash with java.lang.ClassNotFoundException Dec 13, 2023
@lettdev
Copy link

lettdev commented Dec 14, 2023

Same error, it seems that the classes from dependencies are not included in the apk's classes.dex and game always crash with java.lang.ClassNotFoundException. I try a lot of different way but no luck

@kyadalu1
Copy link

I face similar issue here

@code-with-max
Copy link
Author

@lettdev
@kyadalu1

Solution
godotengine/godot#86152 (comment)

@m4gr3d
Copy link
Owner

m4gr3d commented Dec 20, 2023

@trash-max @lettdev @kyadalu1 The dependencies you're trying to import are not included in the Godot Android library since they're not part of the Godot project; they're part of Google's set of libraries.

To include them in your project, you need to update build.gradle.kts and the _get_android_dependencies method with the correct build dependencies.

@m4gr3d m4gr3d closed this as completed Dec 20, 2023
@kyadalu1
Copy link

@m4gr3d Godot relies on kotlin v1.7.0 so i think coroutines needs to be added as separate dependency. In many of my native android projects which uses kotlin v1.9.20 and even for some which uses kotlin v1.8.20, i never had to add couroutines as separate dependency.

Will Godot 4.3 update kotlin version to 1.8 or 1.9?

@m4gr3d
Copy link
Owner

m4gr3d commented Dec 21, 2023

@m4gr3d Godot relies on kotlin v1.7.0 so i think coroutines needs to be added as separate dependency. In many of my native android projects which uses kotlin v1.9.20 and even for some which uses kotlin v1.8.20, i never had to add couroutines as separate dependency.

Will Godot 4.3 update kotlin version to 1.8 or 1.9?

Yes, we should be able to update the Kotlin version for Godot 4.3.

@kyadalu1
Copy link

@m4gr3d Its good to know that kotlin version will be updated for Godot 4.3 but when i try to change it manually like this any idea why it still fails, what else do i need to update?

@m4gr3d
Copy link
Owner

m4gr3d commented Jan 3, 2024

@m4gr3d Its good to know that kotlin version will be updated for Godot 4.3 but when i try to change it manually like this any idea why it still fails, what else do i need to update?

@kyadalu1 The values shown in the config.gradle file match the values used by the Godot Editor when it's exporting the Godot app binary. As such, any changes you make locally won't take effect since the values used by the Godot Editor remain the same.

@kyadalu1
Copy link

kyadalu1 commented Jan 4, 2024

@m4gr3d Can you tell how to update the value in Godot Editor?

Screenshot 2024-01-04 at 8 36 58 AM

I don't see updating the kotlin version option in above screenshot.

Do i have to download godot source code, update kotlin version and somehow recompile the engine for it to take effect?

@m4gr3d
Copy link
Owner

m4gr3d commented Jan 11, 2024

The values cannot be updated from the Godot Editor.

Do i have to download godot source code, update kotlin version and somehow recompile the engine for it to take effect?

Yes, you would have to rebuild the engine from source for the changes to take effect.

@myselfuser1
Copy link

@m4gr3d Can we get kotlin 1.9.20 in Godot 4.3?

@m4gr3d
Copy link
Owner

m4gr3d commented Jan 18, 2024

@m4gr3d Can we get kotlin 1.9.20 in Godot 4.3?

Done in godotengine/godot#87346

@myselfuser1
Copy link

@m4gr3d Thank you so much

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

5 participants