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

Unable to successfully run the Android example for tts-rs. #55

Open
mzdk100 opened this issue Apr 27, 2024 · 2 comments
Open

Unable to successfully run the Android example for tts-rs. #55

mzdk100 opened this issue Apr 27, 2024 · 2 comments

Comments

@mzdk100
Copy link

mzdk100 commented Apr 27, 2024

I cloned the latest tts-rs and opened tts rs/examples/android using IntelliJ IDEA. After clicking "Run", an error occurred:

AndroidRuntime          pid-30765                            E  FATAL EXCEPTION: main
                                                                Process: rs.tts, PID: 30765
                                                                java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{rs.tts/rs.tts.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "rs.tts.MainActivity" on path: DexPathList[[zip file "/data/app/~~B-wOeNZbu9ABdP5z-uMpUQ==/rs.tts-MwtIDebz15srfv5yRxuPlA==/base.apk"],nativeLibraryDirectories=[/data/app/~~B-wOeNZbu9ABdP5z-uMpUQ==/rs.tts-MwtIDebz15srfv5yRxuPlA==/lib/arm64, /system/lib64, /system_ext/lib64]]
                                                                	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3806)
                                                                	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4049)
                                                                	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
                                                                	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                                                                	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                                                                	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
                                                                	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                	at android.os.Looper.loopOnce(Looper.java:211)
                                                                	at android.os.Looper.loop(Looper.java:300)
                                                                	at android.app.ActivityThread.main(ActivityThread.java:8348)
                                                                	at java.lang.reflect.Method.invoke(Native Method)
                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)
                                                                Caused by: java.lang.ClassNotFoundException: Didn't find class "rs.tts.MainActivity" on path: DexPathList[[zip file "/data/app/~~B-wOeNZbu9ABdP5z-uMpUQ==/rs.tts-MwtIDebz15srfv5yRxuPlA==/base.apk"],nativeLibraryDirectories=[/data/app/~~B-wOeNZbu9ABdP5z-uMpUQ==/rs.tts-MwtIDebz15srfv5yRxuPlA==/lib/arm64, /system/lib64, /system_ext/lib64]]
                                                                	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                	at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
                                                                	at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
                                                                	at android.app.Instrumentation.newActivity(Instrumentation.java:1359)
                                                                	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3791)
                                                                	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4049) 
                                                                	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 
                                                                	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
                                                                	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
                                                                	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) 
                                                                	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                	at android.os.Looper.loopOnce(Looper.java:211) 
                                                                	at android.os.Looper.loop(Looper.java:300) 
                                                                	at android.app.ActivityThread.main(ActivityThread.java:8348) 
                                                                	at java.lang.reflect.Method.invoke(Native Method) 
                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582) 
                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028) 
@mzdk100 mzdk100 closed this as completed Apr 27, 2024
@mzdk100 mzdk100 changed the title 我克隆了最新的tts-rs,然后使用IntelliJ IDEA打开了tts-rs/examples/android,点击“Run”后报错: Unable to successfully run the Android example for tts-rs. Apr 27, 2024
@mzdk100 mzdk100 reopened this Apr 27, 2024
@mzdk100
Copy link
Author

mzdk100 commented Apr 27, 2024

Then I guessed that the MainActivity.kt file was not compiled, so I modified the build.gradle file:

plugins {
    id "com.android.application"
    id "org.mozilla.rust-android-gradle.rust-android"
    id "org.jetbrains.kotlin.android"
}
...

Add the line id "org.jetbrains.kotlin.android" to the file, and then run the above error to disappear, but encounter the following error:

AndroidRuntime          rs.tts                               D  Shutting down VM
AndroidRuntime          rs.tts                               E  FATAL EXCEPTION: main
                                                                Process: rs.tts, PID: 32745
                                                                java.lang.UnsatisfiedLinkError: dlopen failed: library "libhello_world.so" not found
                                                                	at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
                                                                	at java.lang.Runtime.loadLibrary0(Runtime.java:998)
                                                                	at java.lang.System.loadLibrary(System.java:1661)
                                                                	at rs.tts.MainActivity.<clinit>(MainActivity.kt:8)
                                                                	at java.lang.Class.newInstance(Native Method)
                                                                	at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
                                                                	at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
                                                                	at android.app.Instrumentation.newActivity(Instrumentation.java:1359)
                                                                	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3791)
                                                                	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4049)
                                                                	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
                                                                	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                                                                	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                                                                	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
                                                                	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                	at android.os.Looper.loopOnce(Looper.java:211)
                                                                	at android.os.Looper.loop(Looper.java:300)
                                                                	at android.app.ActivityThread.main(ActivityThread.java:8348)
                                                                	at java.lang.reflect.Method.invoke(Native Method)
                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)
Process                 rs.tts                               I  Process is going to kill itself!
                                                                java.lang.Exception
                                                                	at android.os.Process.killProcess(Process.java:1330)
                                                                	at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:195)
                                                                	at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
                                                                	at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
                                                                	at java.lang.Thread.dispatchUncaughtException(Thread.java:2306)

@mzdk100
Copy link
Author

mzdk100 commented Apr 27, 2024

This time I checked tts-rs/examples/android/app/build/rustJniLibs and found that this folder is empty. What should I do? Can we use cargo-apk to build it? Because I think cargo-app is better to use.

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