NoClassDefFoundError when importing android directory picker as module - java

im trying to use android directory picker in an application that i am building. this is net.bgreco.DirectoryPicker. my application is called WebDownloader. it seems to run fine. and i am able to launch the directory picker application on its own but when i try to launch it as an activity from my main activity i error mentioned in the title of post.
07-15 21:36:58.740
31945-31945/com.example.zacharymcdaniel.webdownloader
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.zacharymcdaniel.webdownloader, PID: 31945
java.lang.NoClassDefFoundError: Failed resolution of:
Lnet/bgreco/R$layout;
at net.bgreco.DirectoryPicker.onCreate(DirectoryPicker.java:70)
at android.app.Activity.performCreate(Activity.java:6980)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6540)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"net.bgreco.R$layout" on path: DexPathList[[zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/base.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_dependencies_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_0_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_1_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_2_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_3_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_4_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_5_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_6_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_7_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_8_apk.apk",
zip file
"/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.zacharymcdaniel.webdownloader-y2pFpZ6io92LNAzJNpMhyw==/lib/x86,
/system/lib, /system/vendor/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at net.bgreco.DirectoryPicker.onCreate(DirectoryPicker.java:70) 
at android.app.Activity.performCreate(Activity.java:6980) 
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) 
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) 
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6540) 
at java.lang.reflect.Method.invoke(Native Method) 
at
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
WebDownloader and DirectoryPicker are both the top level folders in my android project structure. here is my app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.zacharymcdaniel.webdownloader"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'io.reactivex:rxjava:1.1.6'
compile 'io.reactivex:rxandroid:1.2.1'
compile files('libs/directorypicker.jar')
}
and my manifest:
`<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.zacharymcdaniel.webdownloader">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="net.bgreco.DirectoryPicker"/>
</application>
</manifest>`
and my manifest for DirectoryPicker:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.bgreco"
android:versionCode="2"
android:versionName="1.0.1">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".DirectoryPicker"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
i am trying to make it so that i can launch the directory picker with an Intent and startActivityForResult. please help me find out what is wrong.

Related

Adding MultiDex to a project in android studio but keeping getting java.lang.NoClassDefFoundError

So I am currently trying to import multidex into my project, I have followed the provided documentations/QnA
Android Application using Firebase database keeps crashing when launching?
https://developer.android.com/studio/build/multidex#java
and have done the following amends to my build.gradle app file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.finalyearprojectapp"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
multiDexKeepFile file('multidex-config.txt')
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
//implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-firestore:22.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I have followed the documentation until it has mentioned that I am needed to implement the following code into my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="androidx.multidex.MultiDexApplication" >
...
</application>
</manifest>
I have added this to the manifest, my XML:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.finalyearprojectapp">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="androidx.multidex.MultiDexApplication" >
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainScreen" />
<activity android:name=".RegisterActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
But now I run across this error
Failed to parse XML in C:\Users\jabze\Desktop\FinalApp\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[11,43]
Message: expected start or end tag
Affected Modules: app
I have done literally every tutorial out there and I just cannot figure out the issue, i feel like giving up on this project.
I have tried extending it from each class as mentioned in documentation and all my code has errors to resolve, some with no context.
I have tried extending it using a base class which uses multidex and then trying to add it into the android manifest like this,
android:name=".BaseApp"
Then creating a class to extend from multidex
import androidx.multidex.MultiDexApplication;
public class BaseApp extends MultiDexApplication {
#Override
public void onCreate() {
super.onCreate();
}
}
This has solved the configuration problem, but now i recieve a error when trying to open my app, logcat
2021-03-29 00:28:45.035 31916-31916/? I/lyearprojectap: Not late-enabling -Xcheck:jni (already on)
2021-03-29 00:28:45.054 31916-31916/? I/lyearprojectap: Unquickening 12 vdex files!
2021-03-29 00:28:45.055 31916-31916/? W/lyearprojectap: Unexpected CPU variant for X86 using defaults: x86
2021-03-29 00:28:45.150 31916-31916/com.example.finalyearprojectapp D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
2021-03-29 00:28:45.395 31916-31916/com.example.finalyearprojectapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-03-29 00:28:45.395 31916-31916/com.example.finalyearprojectapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-03-29 00:28:45.398 31916-31916/com.example.finalyearprojectapp I/MultiDex: VM with version 2.1.0 has multidex support
2021-03-29 00:28:45.398 31916-31916/com.example.finalyearprojectapp I/MultiDex: Installing application
2021-03-29 00:28:45.399 31916-31916/com.example.finalyearprojectapp I/MultiDex: VM has multidex support, MultiDex support library is disabled.
2021-03-29 00:28:45.419 31916-31916/com.example.finalyearprojectapp W/ComponentDiscovery: Class com.google.firebase.dynamicloading.DynamicLoadingRegistrar is not an found.
2021-03-29 00:28:45.435 31916-31916/com.example.finalyearprojectapp I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2021-03-29 00:28:45.529 31916-31977/com.example.finalyearprojectapp W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2021-03-29 00:28:45.564 31916-31916/com.example.finalyearprojectapp D/FirebaseAuth: Notifying id token listeners about user ( v9NWiRcvjMTz4y8V8kXy6f7RZdQ2 ).
2021-03-29 00:28:45.566 31916-31916/com.example.finalyearprojectapp D/AndroidRuntime: Shutting down VM
2021-03-29 00:28:45.567 31916-31916/com.example.finalyearprojectapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.finalyearprojectapp, PID: 31916
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListenersCountChangedListener;
at com.google.firebase.auth.zzp.create(Unknown Source:3)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:132)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
at com.google.firebase.components.Lazy.get(Lazy.java:53)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(ComponentRuntime.java:291)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(ComponentRuntime.java:281)
at com.google.firebase.FirebaseApp.initializeAllApis(FirebaseApp.java:584)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:303)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.FirebaseApp$IdTokenListenersCountChangedListener" on path: DexPathList[[zip file "/data/app/~~yUZ3UTW9uE5Wv9gw7MBIVA==/com.example.finalyearprojectapp-ZqPMbXUiTbtxIQSglqq2dg==/base.apk"],nativeLibraryDirectories=[/data/app/~~yUZ3UTW9uE5Wv9gw7MBIVA==/com.example.finalyearprojectapp-ZqPMbXUiTbtxIQSglqq2dg==/lib/x86, /system/lib, /system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.auth.zzp.create(Unknown Source:3) 
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0(ComponentRuntime.java:132) 
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4) 
at com.google.firebase.components.Lazy.get(Lazy.java:53) 
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(ComponentRuntime.java:291) 
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(ComponentRuntime.java:281) 
at com.google.firebase.FirebaseApp.initializeAllApis(FirebaseApp.java:584) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:303) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45) 
at android.app.ActivityThread.installProvider(ActivityThread.java:7239) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697) 
at android.app.ActivityThread.access$1300(ActivityThread.java:237) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
2021-03-29 00:28:45.654 31916-31979/com.example.finalyearprojectapp W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2021-03-29 00:28:45.667 31916-31979/com.example.finalyearprojectapp I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
2021-03-29 00:28:45.667 31916-31979/com.example.finalyearprojectapp I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
You want to create a Base class that extends the MultiDex if you don't have one.
public class BaseApp extends MultiDexApplication {
#Override
public void onCreate() {
super.onCreate();
}
}
Your Manifest can look like below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.finalyearprojectapp">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".BaseApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainScreen" />
<activity android:name=".RegisterActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Edit:
You should upgrade your firebase to the latest, or at least version from 17.0.0 and above.
I was told that According to firebase release notes May 07, 2019, it says; "If you use Firebase Authentication, update to firebase-auth v17.0.0 or later to ensure functionality alignment with other updated Firebase libraries."

ClassNotFoundException on Android API 26 for MainActivity (working with API 30)

I have a Android Studio project which I tested on API 30 and is working fine. Now I tried running it on API 26 (which is the minimum SDK version I set for the project) and I can't get the app to start.
Both times I used an emulated Pixel 3a and one external device.
Error Log:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.main.xyz, PID: 9389
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.main.xyz/com.main.xyz.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.main.xyz.MainActivity" on path: DexPathList[[zip file "/data/app/com.main.xyz-rZkYLBaLo3gdkb7oCChonQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.main.xyz-rZkYLBaLo3gdkb7oCChonQ==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.main.xyz.MainActivity" on path: DexPathList[[zip file "/data/app/com.main.xyz-rZkYLBaLo3gdkb7oCChonQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.main.xyz-rZkYLBaLo3gdkb7oCChonQ==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1173)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.main.xyz-rZkYLBaLo3gdkb7oCChonQ==/base.apk because: Failure to verify dex file '/data/app/com.main.xyz-rZkYLBaLo3gdkb7oCChonQ==/base.apk': Bad method handle type 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:676)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:709)
at android.app.LoadedApk.getResources(LoadedApk.java:936)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2242)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5672)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
... 6 more
My MainActivity.java:
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
//Called by Button
public void login(View v) {
Intent intent = new Intent(MainActivity.this, Uebersicht.class);
startActivity(intent)
}
My build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.main.xyz"
minSdkVersion 26
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
proguardFiles 'proguard-rules.pro'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.android.gms:play-services-vision:20.1.0'
}
My build.grade (project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.main.xyz">
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Uebersicht"
android:label="" />
<activity
android:name=".ProductActivity"
android:label="" />
<activity
android:name=".AddActivity"
android:label=""/>
<activity
android:name=".ScanActivity"
android:label="" />
</application>
</manifest>
I've been looking for a solution for quite a while now. As I'm pretty new to Android all help is deeply appreciated. If you can provide it I'd really to have an explaination to my problem as well as a solution to be able to understand what's going wrong here.
I guess it is a problem with dexing , so try to add this library in your dependencies gradle , so do as following :
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.android.gms:play-services-vision:20.1.0'
implementation 'com.android.support:multidex:1.0.3' // add this library
}
and here add this code
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.main.xyz"
minSdkVersion 26
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
proguardFiles 'proguard-rules.pro'
multiDexEnabled true // add this line of code
}
I looked into the dexing error description and found another question regarding java 8 support. Implementing
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
and
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
into the app's build.gradle file solved the problem.
More information here

Android Studio Unable to start acitivity ComponentInfo

When I try to run the app, I get this error below, and I don't know what exactly is causing it.
Maybe there is some mistake with the project name, activity name, I don't really know what to do about that error.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.homeactivity, PID: 5486
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.homeactivity/com.example.homeactivity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
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.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.getBottomNavigationItemViews(BottomNavigationViewEx.java:569)
at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.setTextVisibility(BottomNavigationViewEx.java:244)
at com.example.homeactivity.MainActivity.onCreate(MainActivity.kt:12)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
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)
 
Here is my AndroidManifest.xml if you want to take a look at it
<?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.homeactivity">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
also, here is my MainActivity.kt:
package com.example.homeactivity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
bottom_navigation_view.setTextVisibility(false)
bottom_navigation_view.enableItemShiftingMode(false)
bottom_navigation_view.enableShiftingMode(false)
bottom_navigation_view.enableAnimation(false)
for (i in 0 until bottom_navigation_view.menu.size()){
bottom_navigation_view.setIconTintList(i, null)
}
}
}
and here is my "app":
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.homeactivity"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
}
I figured it out, the error was in implementation:
implementation 'com.ittianyu:BottomNavigationViewEx:1.2.4'
I just had to add "GitHub" xD
implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'

Unable to resolve java.lang.ClassNotFoundException: Didn't find class "com.example.android.camera2basic.AutoFitTextureView" in android studio?

I am trying to resolve this annoying bug and I have tried every possible option. I went through the previous SO answers and tried invalidating caches and restart. I also made sure that my support dependency in gradle are correct but for some reason my app crashes when I run it on my phone with the following errors.
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.example.android.camera2basic.AutoFitTextureView
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.example.android.camera2basic.AutoFitTextureView
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.camera2basic.AutoFitTextureView" on path: DexPathList[[zip file "/data/app/com.example.surajit.camera2apiexample-2/base.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.surajit.camera2apiexample-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.surajit.camera2apiexample-2/lib/arm, /system/lib, /vendor/lib, /system/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.view.LayoutInflater.createView(LayoutInflater.java:609)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at com.example.surajit.camera2apiexample.Camera2BasicFragment.onCreateView(Camera2BasicFragment.java:455)
at android.app.Fragment.performCreateView(Fragment.java:2352)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
at android.app.BackStackRecord.run(BackStackRecord.java:815)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1578)
at android.app.FragmentController.execPendingActions(FragmentController.java:371)
at android.app.Activity.performStart(Activity.java:6689)
12-12 17:00:55.442 8215-8215/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2687)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
12-12 17:00:58.120 804-903/? E/PROXIMITY: ProximitySensor: unknown event (type=3, code=0)
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.surajit.camera2apiexample"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:support-v13:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.surajit.camera2apiexample">
<uses-permission android:name="android.permission.CAMERA"/><uses-permission android:name="android.permission.FLASHLIGHT"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-feature android:name="android.hardware.camera2.full"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".CameraActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Please help me out. I am really confused with this problem.
This is usually because you're using the wrong package name for your view. You're trying to include view with:
<com.example.android.camera2basic.AutoFitTextureView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
...
/>
which probably not the right package name if we compare it to your AndroidManifest.xml package name, i.e com.example.surajit.camera2apiexample:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.surajit.camera2apiexample">
...
</manifest>
So, change com.example.android.camera2basic.AutoFitTextureView to your View package name where the class AutoFitTextureView reside. It maybe something like this:
<com.example.surajit.camera2apiexample.AutoFitTextureView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
...
/>

Unable to instantiate activity Component Info Class Not found exception Android

My app is deployed directly to any device without any exception. But when .apk is installed it throws the following exception. Secondly it runs fine with Nougat 7.0 and above versions but crashes with same exception for lower OS Versions like 5.0 and 6.0. etc. What is the reason for exception ?
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="amitechnologies.products.apps.equalizeraudioplayer.v3" >
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="amitechnologies.products.apps.equalizeraudioplayer.v3.view.MainActivity"
android:screenOrientation="sensorPortrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/app_name" >
</activity>
</application>
</manifest>
Build.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'm-zaes'
keyPassword 'm-zaes'
storeFile file('D:/AMI_Repo/AMI_Designer/Targets/Android/AMI 3d Player v3/keystore.jks')
storePassword 'm-zaes'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "amitechnologies.products.apps.equalizeraudioplayer.v3"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.1"
signingConfig signingConfigs.config
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFile 'D:/AMI_Repo/AMI_Designer/Targets/Android/AMI 3d Player v3/app/proguard-android.txt'
signingConfig signingConfigs.config
}
}
sourceSets {
main {
jniLibs.srcDir 'jniLibs'
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-ads:10.2.4'
compile 'com.google.apis:google-api-services-youtube:v3-rev180-1.22.0'
compile 'com.android.support:multidex:1.0.1'
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
// CardView
compile 'com.android.support:cardview-v7:25.3.1'
}
productFlavors {
}
}
dependencies {
}
and Stack trace is
Process: amitechnologies.products.apps.equalizeraudioplayer.v3, PID: 15548
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{amitechnologies.products.apps.equalizeraudioplayer.v3/amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles}: java.lang.ClassNotFoundException: Didn't find class "amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles" on path: DexPathList[[zip file "/data/app/amitechnologies.products.apps.equalizeraudioplayer.v3-1/base.apk"],nativeLibraryDirectories=[/data/app/amitechnologies.products.apps.equalizeraudioplayer.v3-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2564)
at android.app.ActivityThread.access$800(ActivityThread.java:170)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5576)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
Caused by: java.lang.ClassNotFoundException: Didn't find class "amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles" on path: DexPathList[[zip file "/data/app/amitechnologies.products.apps.equalizeraudioplayer.v3-1/base.apk"],nativeLibraryDirectories=[/data/app/amitechnologies.products.apps.equalizeraudioplayer.v3-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1070)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2385)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2564) 
at android.app.ActivityThread.access$800(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:194) 
at android.app.ActivityThread.main(ActivityThread.java:5576) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750) 
Suppressed: java.lang.ClassNotFoundException: amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
and Folder Structure:
As Discussion in chat i found that, Your manual way of generating APK
is not generating the correct APK, so i am Suggesting these way to
generating APK for Manual Install:
For Debug Build
Delete you build folder inside the App folder.
Goto Build>Build APk. it will generate .apk file in your
app>build>output>apk directory.
COPY it your device and install manually.
For Release Build
Delete you build folder inside the App folder.
Goto Build>Generate Signed APk and provide recomended Details, make sure your Build type : release and have checked both signature version v1(jar signature) and v2(full apk signature) . it will generate .apk file in your
app>build>output>apk directory.
COPY it your device and install manually.
At first "Clean" and "Sync Project with Gradle Files". Then run your code
Replace this
<activity
android:name="amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles"
</activity>
with this
<activity
android:name=".amitechnologies.products.apps.equalizeraudioplayer.v3.view.LoaderOfAllMediaFiles"
</activity>
The reason is you have missed a dot(.) in android:name
If your minSDK version less than 21 you need to do the following for multidex
build.gradle
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your_app_package">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
Delete your Build folder inside the app folder and rebuild your project

Categories