I am trying to implement AWS Amplify/Cognito libraries for my app, but am getting the following error when launching the application on an emulator running Marshmallow. I followed the following instructions, but it still isn't working because I am getting the following error:
2021-06-26 11:02:01.160 9787-9815/com.example.sprout E/AndroidRuntime: FATAL EXCEPTION: Thread-2
Process: com.example.sprout, PID: 9787
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
at java.lang.Class.newInstance(Native Method)
at com.amazonaws.mobile.client.AWSMobileClient.getClient(AWSMobileClient.java:2139)
at com.amazonaws.mobile.client.AWSMobileClient$19.run(AWSMobileClient.java:2005)
at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115)
at com.amazonaws.mobile.client.AWSMobileClient.showSignIn(AWSMobileClient.java:1957)
at com.example.sprout.AuthenticationActivity.showSignIn(AuthenticationActivity.kt:42)
at com.example.sprout.AuthenticationActivity.access$showSignIn(AuthenticationActivity.kt:12)
at com.example.sprout.AuthenticationActivity$onCreate$1.onResult(AuthenticationActivity.kt:26)
at com.example.sprout.AuthenticationActivity$onCreate$1.onResult(AuthenticationActivity.kt:18)
at com.amazonaws.mobile.client.internal.InternalCallback.call(InternalCallback.java:75)
at com.amazonaws.mobile.client.internal.InternalCallback.onResult(InternalCallback.java:62)
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:424)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/data/app/~~orMxE1QpBfs6NjTHCuQmbw==/com.example.sprout-oiakh9w-JZy8uH5nAXFAHw==/base.apk"],nativeLibraryDirectories=[/data/app/~~orMxE1QpBfs6NjTHCuQmbw==/com.example.sprout-oiakh9w-JZy8uH5nAXFAHw==/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 java.lang.Class.newInstance(Native Method)
at com.amazonaws.mobile.client.AWSMobileClient.getClient(AWSMobileClient.java:2139)
at com.amazonaws.mobile.client.AWSMobileClient$19.run(AWSMobileClient.java:2005)
at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115)
at com.amazonaws.mobile.client.AWSMobileClient.showSignIn(AWSMobileClient.java:1957)
at com.example.sprout.AuthenticationActivity.showSignIn(AuthenticationActivity.kt:42)
at com.example.sprout.AuthenticationActivity.access$showSignIn(AuthenticationActivity.kt:12)
at com.example.sprout.AuthenticationActivity$onCreate$1.onResult(AuthenticationActivity.kt:26)
at com.example.sprout.AuthenticationActivity$onCreate$1.onResult(AuthenticationActivity.kt:18)
at com.amazonaws.mobile.client.internal.InternalCallback.call(InternalCallback.java:75)
at com.amazonaws.mobile.client.internal.InternalCallback.onResult(InternalCallback.java:62)
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:424)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:923)
Here is my project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.10"
repositories {
google()
mavenCentral()
maven{
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven{
url "https://plugins.gradle.org/m2/"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is my app gradle:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.amazonaws.appsync'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.sprout"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'com.amazonaws:aws-android-sdk-appsync:2.6.+'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
// Mobile Client for initializing the SDK
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.8.+#aar') { transitive = true }
// Cognito UserPools for SignIn
implementation('com.amazonaws:aws-android-sdk-auth-userpools:2.8.+#aar') { transitive = true }
// Sign in UI Library
implementation('com.amazonaws:aws-android-sdk-auth-ui:2.8.+#aar') { transitive = true }
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Any clue what I might be doing wrong? Thanks in advance!
Related
As normal I was working on my actual project and I wanted to add something new to an old activity. When I opened the .java file a new error has shown with a reason that I can not think about. It says that the FirebaseAuth symbol cannot be resolved. I checked my Gradle ( which is updated to the latest version) and the code but I can't find a solution. I would really appreciate it if someone would help me.
A screenshot:
The Gradle module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.diligent"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += [
"room.schemaLocation":"$projectDir/schemas".toString(),
"room.incremental":"true",
"room.expandProjection":"true"]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.core:core-ktx:1.3.2'
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.android.gms:play-services-ads:20.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.congtung10t2:circularseekbarplus:1.0'
implementation 'com.google.firebase:firebase-auth:20.0.4'
implementation 'com.google.firebase:firebase-database:19.7.0'
}
And Project:
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.5'
classpath "com.google.gms:google-services:4.3.5"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
}
}
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
this error occurred when I tried to set up my firebase with this project.
after searching...I found a solution which after then both synced and build works fine and the app run on my device.
But the problem is that:
I don't understand which pair version of android.support and firebase to use.
though the app works fine it's still showing red underlined.
Thanks for the help.
build.gradle(project)
build.gradle(app)
AndroidManifest
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.collegeapp"
minSdkVersion 15
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'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation 'com.google.firebase:firebase-analytics:15.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
build.gradle(project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Try to use upgrade version of firebase-analtyics.
implementation 'com.google.firebase:firebase-analytics:16.0.0'
I have tried to fix this error, but I don't know what it the main problem in my case.
The error I get is about adding dependencies or the version of my dependencies if there is a solution please help:
My gradle file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
the app.gradle file is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig
applicationId "me.ismashot.ibtassim"
minSdkVersion 15
targetSdkVersion 28
versionCode 59
versionName '4.6'
multiDexEnabled true
}
dexOptions {
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
productFlavors {
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.chrisbanes.photoview:library:1.2.3'
implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
implementation 'com.pkmmte.view:circularimageview:1.1'
implementation 'com.melnykov:floatingactionbutton:1.3.0'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:mediarouter-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'
Anyone help me fixing this issue with my application guys ?
Add the missing { to your defaultConfig:
android {
...
defaultConfig {
applicationId "me.ismashot.ibtassim"
...
}
...
}
Edit:
For fixing Failed to resolve: play-services-basement make sure to bring google() repository before jcenter() in the all repositories blocks:
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
jcenter()
}
I built my game via buildbox. My App kept crashing due to the error pasted below:
Fatal Exception: java.lang.AbstractMethodError: abstract method "void com.google.firebase.iid.zzb.zzd(android.content.Intent)"
at com.google.firebase.iid.zzc.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6)
at java.lang.Thread.run(Thread.java:760)
I fixed this error by putting the following command in AndroidManifext.xml:
<service android:name=".PTPlayer">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Now I am faced with a new crash reason:
Caused by: java.lang.ClassCastException: com.torsolutions.kawabachao.PTPlayer cannot be cast to android.app.Service
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3524)
at android.app.ActivityThread.-wrap4(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1786)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
My android level build gradle is:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
}
and App level build gradle is:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
signingConfigs {
config {
keyAlias 'upload'
keyPassword 'Hello#1986'
storeFile file('D:/kawakey/kawauploadkey/KawaUploadKey1.jks')
storePassword 'Hello#1986'
}
}
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.torsolutions.kawabachao"
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
ndk {
moduleName "player_shared"
}
versionName '2.1'
versionCode 9
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
productFlavors {
}
}
dependencies {
implementation 'com.google.android.gms:play-services:+'
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-games:16.0.0'
implementation 'com.google.android.gms:play-services- identity:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
}
apply plugin: 'com.google.gms.google-services'
What I am faced with now is the App crashing within 30 minutes of launch. At times it doesn't crash for a few minutes but usually it crashes within the first minute. This has lead to a significant amount of uninstalls.
Would be grateful if someone can help. I have tried the solutions on the forum so far but no solutions yet.
I try implementing an app that put details about you in database in Firebase.
I do the sync with the code from the website from Firebase
Android Studio Version: 3.0.1
The Code is from THIS
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
//you need to add this line
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle in the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.eranp.clientpage"
minSdkVersion 19
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/activation.jar')
implementation files('libs/additionnal.jar')
implementation files('libs/mail.jar')
compile 'com.google.firebase:firebase-auth:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
The error output:
Error:Could not find com.google.gms:google-services:3.2.0. Searched
in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.jar
Required by:
project :
What do I need to do to fix that?