Android Resource Unable to find resource ID #0x7f070024 - java

This has been the first time I've ever encountered an issue like this and I'm a bit dumbfounded by it. My problem is whenever I debug my application, everything is all fine and dandy, but as soon as I generate an apk and distribute it through crashlytics to my beta testers, all hell breaks lose and I'm thrown this Resources$NotFoundExeption.
I checked my R.java file for resource 0x7f070024 and found that it shows this:
public static final int common_google_play_services_unknown_issue=0x7f070024;
This didn't mean like much to me. I then proceeded to the other string resource error which was pointing to resource id 0x7f070036 which shows me:
public static final int app_name=0x7f070036;
I checked the usage of this variable and the only place that I'm using this string resource is inside the AndroidManifest.xml :
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" //**HERE**
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<meta-data
android:name="io.fabric.ApiKey"
android:value="blablablah"/>
<activity
android:name=".views.activities.LoginActivity"
android:configChanges="keyboard|keyboardHidden"
android:screenOrientation="portrait">
<intent-filter android:label="#string/app_name"> //**HERE**
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Just to complete this question, let me add my gradle files as they may be important to solving this problem:
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "helpme.jesus"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:design:23.1.0'
compile 'de.greenrobot:greendao:2.0.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.squareup.dagger:dagger:1.2.2'
compile 'com.birbit:android-priority-jobqueue:1.3.5'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.google.zxing:core:3.2.1'
compile('com.crashlytics.sdk.android:crashlytics:2.5.7#aar') {
transitive = true;
}
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.0-beta.2#aar') {
transitive = true
}
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
}
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'com.google.gms:google-services:2.0.0-alpha5'
}
}
What am I missing? What am I doing incorrectly?
Logcat files will be added here just incase:
06-21 18:28:37.171 25824-25824/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: dev.helpme.jesus, PID: 25824
java.lang.RuntimeException: Unable to get provider com.google.android.gms.measurement.AppMeasurementContentProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f070024
at android.app.ActivityThread.installProvider(ActivityThread.java:5092)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4669)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5345)
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:947)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f070024
at android.content.res.Resources.getResourcePackageName(Resources.java:2089)
at com.google.android.gms.measurement.zza.<init>(Unknown Source)
at com.google.android.gms.measurement.zza.zzaR(Unknown Source)
at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source)
at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source)
at com.google.android.gms.measurement.internal.zzw.<init>(Unknown Source)
at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source)
at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source)
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at android.app.ActivityThread.installProvider(ActivityThread.java:5089)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4669) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609) 
at android.app.ActivityThread.access$1500(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5345) 
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:947) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742) 
06-21 18:28:37.231 533-556/? W/PackageManager: Failure retrieving text 0x7f070036 in package dev.helpme.jesus
android.content.res.Resources$NotFoundException: String resource ID #0x7f070036
at android.content.res.Resources.getText(Resources.java:299)
at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:1155)
at android.content.pm.PackageItemInfo.loadLabel(PackageItemInfo.java:131)
at android.app.ApplicationPackageManager.getApplicationLabel(ApplicationPackageManager.java:1199)
at com.android.server.am.AppErrorDialog.<init>(AppErrorDialog.java:48)
at com.android.server.am.ActivityManagerService$MainHandler.handleMessage(ActivityManagerService.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)

I've got the similar issue with
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
I tried with clean project, rebuild project, invalidate Android Studio cache. Still no luck /_\
But when I changed to
classpath 'com.android.tools.build:gradle:2.1.2'
The problem disappeared. Same code! All other settings same!
I think it was a bug in gradle build 2.2.0-alpha3
Always got problems with gradle alpha...

Related

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"
...
/>

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo in a New Project - Android 3 Canary 7

I have a problem, I have it with all my projects, so I came up with a new project with Android 3 Canary 7, but it always gives me the same error.
I have MacOS Sierra 10.12.6
It's a complete new project, so i don't know what to do to solve it
This error occurs:
07-24 10:25:57.776 29708-29708/com.estebanmoncaleano.myapplication
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.estebanmoncaleano.myapplication, PID: 29708
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.estebanmoncaleano.myapplication/com.estebanmoncaleano.myapplication.MainActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.estebanmoncaleano.myapplication.MainActivity" on path:
DexPathList[[zip file
"/data/app/com.estebanmoncaleano.myapplication-2/base.apk", zip file
"/data/app/com.estebanmoncaleano.myapplication-2/split_lib_dependencies_apk.apk"],nativeLibraryDirectories=[/vendor/lib,
/system/lib]]
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2972)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3243)
at android.app.ActivityThread.access$1000(ActivityThread.java:218)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1718)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6917)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.estebanmoncaleano.myapplication.MainActivity" on path:
DexPathList[[zip file
"/data/app/com.estebanmoncaleano.myapplication-2/base.apk", zip file
"/data/app/com.estebanmoncaleano.myapplication-2/split_lib_dependencies_apk.apk"],nativeLibraryDirectories=[/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:1094)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2962)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3243) 
at android.app.ActivityThread.access$1000(ActivityThread.java:218) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1718) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:145) 
at android.app.ActivityThread.main(ActivityThread.java:6917) 
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:1404) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
Suppressed: java.lang.ClassNotFoundException:
com.estebanmoncaleano.myapplication.MainActivity
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
My Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.estebanmoncaleano.myapplication"
minSdkVersion 16
targetSdkVersion 26
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(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
My Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.estebanmoncaleano.myapplication">
<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>
</application>
</manifest>
My Gradle Proyect Settings:
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.enableAapt2=false
What do you think I can do to solve my problem?
Thanks for your time!
Seems instant run is broken.
Try Stop → Run(not Apply changes - yellow lighting-shape), or Clean → Rebuild.
Clean your project, rebuild and run it. That's working for me. Thanks.

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

Not able to run debug apk on android phone

I am using Android studio 2.3.1 on windows 10. When I tried to run the app on device, when my device is connected to android studio, then I am able to run the app. But when I tried to install its debug or release apk on android phone then it is getting installed but while opening the app it gives following error:
04-27 10:06:31.675 30541-30541/package name E/AndroidRuntime: FATAL EXCEPTION: main
Process: package_Name, PID: 30541
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{package Name/package_Name.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "package_Name.SplashActivity" on path: DexPathList[[zip file "/data/app/package_Name-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2227)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2376)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5253)
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:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Caused by: java.lang.ClassNotFoundException: Didn't find class "package_Name.SplashActivity" on path: DexPathList[[zip file "/data/app/package_Name-1/base.apk"],nativeLibraryDirectories=[/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:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2217)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2376)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5253)
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:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Suppressed: java.lang.ClassNotFoundException: package Name.SplashActivity
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
Any help will be appreciated.
My gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "package_Name"
minSdkVersion 15
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(dir: 'libs', include: ['*.jar'])
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'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
You can solve this with just "Build (tab) / Build APK" instead of Run 'app'
#ASK could you please clean your project and rebuild it. This is the error mostly obtained when your apk is not properly created
Your package name should not contain space as from your code their is space in the package name
Please change it to like package.name
The problem might have occurred because you have you might have exceeded the 64k method limit.
You should consider enabling multidex in your app.
defaultConfig {
...
...
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Also add this to manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
Uncheck Instant Run..
How to do this:
Open the Settings or Preferences dialog: On Windows or Linux, select File > Settings from the menu bar. On Mac OSX, select Android Studio > Preferences from the menu bar.
Navigate to Build, Execution, Deployment > Instant Run.
Uncheck the box next to Restart activity on code changes.

How can I use a JavaFX activity in an Android project? (Kokos sample project)

I'm trying to run the javafxports sample project Kokos as I want to use JavaFX components in an app built in Android Studio but can't get it to build properly, I can build all other samples but this mixed approach isn't working.
When I build I just get a black screen and the error "java.lang.ClassNotFoundException: Didn't find class "org.javafxports.kokos.Main" on path: DexPathList[[zip file "/data/app/org.javafxports.kokos-2/base.apk"]"
As far as I can tell, none of the kokos classes are actually built into the apk hence why it can't find them, but I can't work out why and this is the only sample I can find of this approach.
Is anyone able to successfully build and run the Kokos sample and if so, did it require any modification?
Alternatively is there another example of using JavaFX components in an Android project like this that I could use as a basis? I just want to be able to have an app consisting of native Android activities but with the ability to launch into a JavaFX activity.
The error message given is:
02-01 21:43:16.406 17575-17575/org.javafxports.kokos V/DalvikLauncher: Launch JavaFX application on DALVIK vm.
02-01 21:43:16.409 17575-17575/org.javafxports.kokos V/DalvikLauncher: We have JavaFX on our current (base) classpath, registered exit listener
02-01 21:43:16.410 17575-17575/org.javafxports.kokos E/DalvikLauncher: Launch failed with exception.
java.lang.ClassNotFoundException: Didn't find class "org.javafxports.kokos.Main" on path: DexPathList[[zip file "/data/app/org.javafxports.kokos-1/base.apk"],nativeLibraryDirectories=[/data/app/org.javafxports.kokos-1/lib/arm, /data/app/org.javafxports.kokos-1/base.apk!/lib/armeabi, /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 javafxports.android.DalvikLauncher.resolveApplicationClass(DalvikLauncher.java:262)
at javafxports.android.DalvikLauncher.launchApp(DalvikLauncher.java:164)
at javafxports.android.FXDalvikEntity.getLauncherAndLaunchApplication(FXDalvikEntity.java:162)
at javafxports.android.FXDalvikEntity.surfaceCreated(FXDalvikEntity.java:304)
at android.view.SurfaceView.updateWindow(SurfaceView.java:583)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:177)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2063)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
Suppressed: java.lang.ClassNotFoundException: Didn't find class "org.javafxports.kokos.Main" on path: DexPathList[[dex file "/data/dalvik-cache/xposed_XResourcesSuperClass.dex"],nativeLibraryDirectories=[/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:504)
... 23 more
Suppressed: java.lang.ClassNotFoundException: org.javafxports.kokos.Main
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)
... 24 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
02-01 21:43:16.411 17575-17575/org.javafxports.kokos V/FXEntity: Called Surface changed [1080, 1848], format 4
02-01 21:43:16.411 17575-17575/org.javafxports.kokos V/FXActivity native: [JVDBG] SURFACE created native android window at 0xa47cd508, surface = 0xff9d0f60
02-01 21:43:16.412 17575-17575/org.javafxports.kokos V/FXEntity: Called Surface redraw needed
02-01 21:43:16.423 17575-17575/org.javafxports.kokos V/FXEntity: Called Surface redraw needed
02-01 21:43:16.441 1378-1536/system_process I/ActivityManager: Displayed org.javafxports.kokos/javafxports.android.FXActivity: +330ms
Here is my app/build.gradle file, I've tried to update the dependencies but still am having issues, is there anything obviously wrong?
My original app/build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
repositories {
jcenter()
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
// minSdkVersion 16
buildToolsVersion "23.0.2"
dexOptions {
preDexLibraries = false
}
defaultConfig {
applicationId "lodgon.org.kokos"
minSdkVersion 16
targetSdkVersion 16
versionCode 1
versionName "1.0"
multiDexEnabled true
}
sourceSets {
main {
jniLibs.srcDir file("/opt/dalvik-sdk/rt/lib")
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: '/opt/dalvik-sdk/rt/lib/ext')
}
project.tasks.withType(com.android.build.gradle.tasks.Dex) {
additionalParameters=['--core-library']
}
My edited app/build.gradle
I applied some suggested fixes, and changed the applicationID and dalvik-sdk location but am still having the same issue, file now looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
repositories {
jcenter()
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
// minSdkVersion 16
buildToolsVersion "23.0.2"
dexOptions {
preDexLibraries = false
}
defaultConfig {
applicationId "javafxports.org.kokos"
minSdkVersion 16
targetSdkVersion 16
versionCode 1
versionName "1.0"
multiDexEnabled true
}
sourceSets {
main {
jniLibs.srcDir file("C:\\Users\\AdamL\\.gradle\\caches\\modules-2\\files-2.1\\org.javafxports\\dalvik-sdk\\8.60.8\\6630ec66e4703c910ac3fd6151a8494c8b59186b\\unpacked\\dalvik-sdk\\rt\\lib")
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'C:\\Users\\AdamL\\.gradle\\caches\\modules-2\\files-2.1\\org.javafxports\\dalvik-sdk\\8.60.8\\6630ec66e4703c910ac3fd6151a8494c8b59186b\\unpacked\\dalvik-sdk\\rt\\lib\\ext')
}
project.tasks.withType(com.android.build.gradle.tasks.Dex) {
additionalParameters=['--core-library']
}
Android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="javafxports.org.kokos" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="javafxports.org.kokos.MainActivity"
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>
Theseare the changes I've made from the downloaded sample project
JavaFXPorts plugin changed to version 1.32
Changed android-gradle plugin references to version 2.2.3
Changed retrolamba version to 3.5.0
Changed applicationID to correct one
Changed dalvik-sdk location to correct one
The build is being run from the containing samples project like: gradlew :Kokos:androidInstall
There are several problems on your build.gradle file.
The application id is wrong, you should use the package name:
defaultConfig {
applicationId "javafxports.org.kokos"
...
}
The dalvik-sdk path is incorrect. The one you have (/opt/dalvik-sdk) is Linux based.
If you have tried the other JavaFXPorts samples, you will have already downloaded a recent version of the dalvik-sdk, and it will be installed in the .gradle repository.
You will find it under:
C:\Users\<user>\.gradle\caches\modules-2\files-2.1\org.javafxports\dalvik-sdk\8.60.8\<id>\unpacked\dalvik-sdk
Find the right path and replace it in both sourceSets (jniLibs.srcDir) and dependencies.
In case this is helpful to anyone else, I found out what was wrong in my case.
The samples project readme file suggests you should be able to run the project from the root samples project like the other projects using `gradlew :Kokos:androidInstall- or at least it doesn't claim otherwise. This is NOT how I had success running the project.
To run this project, open just the Kokos project and use gradlew installDebug
Additionally I updated my dependencies, Davik SDK location (as Jose Pereda suggested) and changed the way the core-library flag was set in gradle to replace the old way:
dexOptions {
...
additionalParameters=[ '--core-library']
...
}

Categories