My App is not starting , with following error - android

my app is not starting, my logcat is below, I don't able to understand this error, I m beginer,
what mistakes I have done so I m getting this error, I found similar a Qestion here but the answers is too confusing I don't able to get E/LoadedApk: Unable to instantiate appComponentFactory only on Android Q (API 29)
also getting this
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
E/LoadedApk: Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path:
DexPathList[[],nativeLibraryDirectories=[/data/app/com.whatsapp-fssQPC-1LXhux2cD4hnAgQ==/lib/arm64,
/data/app/com.whatsapp-fssQPC-1LXhux2cD4hnAgQ==/base.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:171)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.LoadedApk.createAppFactory(LoadedApk.java:228)
at android.app.LoadedApk.updateApplicationInfo(LoadedApk.java:340)
at android.app.ActivityThread.handleDispatchPackageBroadcast(ActivityThread.java:5451)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1756)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at com.android.server.SystemServer.run(SystemServer.java:475)
at com.android.server.SystemServer.main(SystemServer.java:310)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:853)
My gradle.build is
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.somusmall"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
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 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
My Menifest file is
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<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"></activity>
<activity android:name=".video_layout" />
<activity android:name=".RegisterActivity" />
<activity android:name=".Splash_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>

Try adding the above class to proguard-rules.
-keep class androidx.core.app.CoreComponentFactory { *; }
https://dzone.com/articles/enabling-proguard-for-android
Works for me. :)

Related

Your device isnt compatible with this version - shows on all device

I recently uploaded my game on play store. The game works fine in my mobile. but i tried to install it in my friends(3-4) mobile phones it gives below error.
Your device isnt compatible with this version
Here is my android manifest
<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">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8853085470060311~2582555526"/>
<service
android:name="com.ak.fulligola.MusicService"
android:enabled="true" />
<activity android:name="com.ak.fulligola.HomePage">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.ak.fulligola.MainActivity" />
<activity android:name="com.ak.fulligola.CharacterSelection" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
Below is my build.gradle
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.ak.fulligola"
minSdkVersion 28
targetSdkVersion 29
versionCode 2
versionName "2.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 'androidx.appcompat:appcompat: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.gms:play-services-ads:19.2.0'
}
Please help to solve.
Also i have ads in my game. so do i need to provide internet permission.?
Your application supports only Android Pie (9) and Android Q(10) only.
To support vast number of devices, please change minSdkVersion to 23 and update target version to latest available i.e. 30.
Yes, Internet permission is required to show the Ads.

manifest merger failed-appcomponentfactory [duplicate]

i am new in android and have an app that when build my project have this Error ::
ERROR: Manifest merger failed : Attribute
application#appComponentFactory
value=(androidx.core.app.CoreComponentFactory) from
[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 is also
present at [com.android.support:support-compat:28.0.0]
AndroidManifest.xml:22:18-91
value=(android.support.v4.app.CoreComponentFactory). Suggestion: add
'tools:replace="android:appComponentFactory"' to element
at AndroidManifest.xml:9:5-44:19 to override.
My Gradle build is ::
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "maa.tic_tac_to"
minSdkVersion 19
targetSdkVersion 28
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'])
implementation 'com.google.firebase:firebase-messaging:19.0.1'
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:24.2.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support:support-v4:28.+'
// implementation ('com.theartofdev.edmodo:android-image-cropper:2.4.+'){
// exclude group: 'com.android.support'
//}
// implementation 'com.google.android.material:material:1.0.0-alpha08'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
// implementation 'com.androidx.constraintlayout.widget:ConstraintLayout:2.0.0-beta2'
testImplementation 'junit:junit:4.12'
}
and manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="maa.tic_tac_to">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application
android:allowBackup="true"
android:icon="#drawable/tic_tac_toe"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity"></activity>
<receiver
android:name=".MySMSReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<activity android:name=".FakeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LogInActivity"></activity>
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
i test every solution in stackoverflow and google search but anyone help me.
can anyone help to solve this error ?!?!?!?
You are using
implementation 'com.google.firebase:firebase-messaging:19.0.1'
Firebase migrated to AndroidX in the latest release.
It means that you are using both, support libraries and androidx libraries.
You can:
migrate to androidx as described below
downgrade your firebase dependencies (but it is not a real solution because you have to migrate sooner or later)
You can check the official release notes:
Warning: This release is a MAJOR version update and breaking change.
The latest update to Google Play services and Firebase includes the following changes:
Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.

Application crashing when another activity is added

I am creating an android application that logs in the user via email authentication through firebase and on successful login the app will shift to another activity.
Now the problem is while the single activity for login is working fine but as soon as I add another activity on which it has to jump and try to run again then this error
NoClassDefFoundError: Failed resolution of:
Landroid/view/View$OnUnhandledKeyEventListener;
comes up and the application automatically closes.
I have tried many different options but none of them works. Have restarted my pc, invalidated the cache but still no luck.
.gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.arviadmin"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.arviadmin">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<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"></activity>
<activity
android:name=".LoginActivity"
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>
The manifest file seems fine. If everything in LoginActivity, MainActivity and xml are correct I suggest you to delete the build folders - because you have already invalidate the cache.
project-folder/build
project-folder/app/build
If it still don't work I suggest you to comment everything on those classes and start uncommenting while testing.

java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurement" on path: DexPathList

My app was running well but it is crashing now. I started getting warnings even though I am not integrating with firebase. Now I think that I can not solve this problem. I tried every possible solution available on stackoverflow. Also, I am using viewpager in my code if that helps.
LogCat
W/Ads: Invoke Firebase method getInstance error.
java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurement" on path: DexPathList[[zip file "/data/app/com.kidsbox.android.abcforkidsalphabetshapesandnumbers-1/base.apk"],nativeLibraryDirectories=[/data/app/com.kidsbox.android.abcforkidsalphabetshapesandnumbers-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 com.google.android.gms.ads.internal.scionintegration.b.a(:com.google.android.gms.DynamiteModulesA:167)
at com.google.android.gms.ads.internal.scionintegration.b.a(:com.google.android.gms.DynamiteModulesA:152)
at com.google.android.gms.ads.internal.scionintegration.b.g(:com.google.android.gms.DynamiteModulesA:43)
at com.google.android.gms.ads.internal.request.c.a(:com.google.android.gms.DynamiteModulesA:26)
at com.google.android.gms.ads.internal.util.b.run(:com.google.android.gms.DynamiteModulesA:4)
at com.google.android.gms.ads.internal.util.af.call(:com.google.android.gms.DynamiteModulesA:3)
at com.google.android.gms.ads.internal.util.ag.run(:com.google.android.gms.DynamiteModulesA:3)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.measurement.AppMeasurement
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 trace available
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kidsbox.android.abcforkidsalphabetshapesandnumbers">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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=".Alphabet" />
<activity android:name=".Number" />
<activity android:name=".Shapes"/>
</application>
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.kidsbox.android.abcforkidsalphabetshapesandnumbers"
minSdkVersion 16
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.google.android.gms:play-services-ads:11.0.4'
testCompile 'junit:junit:4.12'
}
I think this issue is similar with How to enable multidexing with the new Android Multidex support library
Add implementation "com.android.support:multidex:1.0.1" in your build.gradle's dependencies ( implementation can be replaced with compile );
Add a custom application extends from Application. Add code as below:
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
MultiDex.install(this)
}
Add your custom application in AnroidManifest.xml as android:name=".CustomApplication"
You should use compile 'com.google.firebase:firebase-ads:11.2.0'
instead of compile 'com.google.android.gms:play-services-ads:11.2.0'

Firebase ads: java.lang.InstantiationError: com.google.android.gms.internal.zznv

Adding AdMob to my Android app drives me mad :o
Firebase is already running (auth, db, ...).
I added gradle dependency for ads too.
I followed Google instructions exactly.
I have two issues:
The AdView Container in my xml layout file cannot be rendered in the preview. It says:
The following classes could not be instantiated: com.google.android.gms.ads.AdView
Exception Details java.lang.NoClassDefFoundError: Could not initialize class com.google.android.gms.internal.zzeh   at com.google.android.gms.internal.zzez.  at com.google.android.gms.internal.zzez.  at com.google.android.gms.internal.zzez.  at com.google.android.gms.ads.BaseAdView.  at com.google.android.gms.ads.AdView.  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
If I try to initialize ads in my code, it crashes in this code-line:
MobileAds.initialize(getApplicationContext(), "ca-app-pub-XXXXXXXXXXXXXXXXX");
E/UncaughtException: java.lang.InstantiationError: com.google.android.gms.internal.zznv
at com.google.android.gms.internal.zzeh.(Unknown Source)
at com.google.android.gms.internal.zzeh.(Unknown Source)
at com.google.android.gms.internal.zzfb.zza(Unknown Source)
at com.google.android.gms.ads.MobileAds.initialize(Unknown Source)
at com.google.android.gms.ads.MobileAds.initialize(Unknown Source)
at de.philweb.myweightlog.MainActivity.onCreate(MainActivity.java:233)
I tried everything I found on SO. Like MultiDex and adding AdsActivity to manifest, no success. Now I really need your help :(
Thanks guys,
phil
the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.philweb.myweightlog">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyAppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
this is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "de.philweb.myweightlog"
minSdkVersion 16
targetSdkVersion 22
// multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1' //22.2.0'
compile 'com.android.support:support-v4:25.0.1' //22.2.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
// compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.firebaseui:firebase-ui:1.0.0'
compile "com.androidplot:androidplot-core:1.4.0"
compile 'com.darwinsys:hirondelle-date4j:1.5.1'
compile('com.mikepenz:materialdrawer:5.8.0#aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
The size and number of included libraries requires Multidex. You say you tried to enable it. Note that three steps are required, including a change to the manifest.
Also, when using version 10.0.1 of the Firebase libs, you must use version 1.0.1 of Firebase UI:
compile 'com.firebaseui:firebase-ui:1.0.1'
The Firebase UI docs contains a table of compatible versions.
<uses-permission android:name="android.permission.INTERNET"/>
put this in menifest.

Categories

Resources