This is my first project that I make an Android app and my app always stop when i run it, this error below I found in Logcat
2024-08-13 16:11:02.769 13034-13034 System com.example.tester W ClassLoader referenced unknown path: /data/app/com.example.tester-1/lib/x86
2024-08-13 16:11:02.784 13034-13034 FirebaseApp com.example.tester I Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2024-08-13 16:11:02.785 13034-13034 FirebaseInitProvider com.example.tester I FirebaseApp initialization successful
2024-08-13 16:11:02.793 13034-13034 AndroidRuntime com.example.tester D Shutting down VM
2024-08-13 16:11:02.793 13034-13034 AndroidRuntime com.example.tester E FATAL EXCEPTION: main
Process: com.example.tester, PID: 13034
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.tester/com.example.tester.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.tester.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.tester-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.tester-1/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.tester.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.tester-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.tester-1/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
2024-08-13 16:11:17.753 13034-13040 art com.example.tester I Debugger is no longer active
2024-08-13 16:11:17.754 13034-13040 art com.example.tester I Starting a blocking GC Instrumentation
This is the only my activity
package com.example.sktt
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.example.tester.R
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener
class MainActivity : AppCompatActivity() {
private val databaseReference = FirebaseDatabase.getInstance().getReference()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//getting TextViews from xml file
//getting data from Firebase
databaseReference.addValueEventListener(object : ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
val getKey1Value = snapshot.child("EEG").getValue(
String::class.java
)
val key1Value = findViewById<TextView>(R.id.key1Value)
//getting data to TextViews
key1Value.text = getKey1Value
}
override fun onCancelled(error: DatabaseError) {
}
})
}
}
This is my AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.tester">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Tester"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Tester"
tools:ignore="Instantiatable,MissingClass">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This project is used to get data from Firebase and ESP32, and I would be grateful if you could just help me with how to fix these errors. I thank you very much
New contributor
user23049825 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.