How do I add AWS Amplify into my android application? - android

I am following the AWS docs, here. I am able to add everything into my project's build.gradle, AndroidManifest.xml, and app's build.gradle EXCEPT for the apply plugin. When I add:
apply plugin: 'com.amazonaws.appsync'
I get the following error:
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.amazonaws.appsync']
How do I fix this? When I remove the apply plugin from the app's build.gradle, then my app works again.

Did you try updating you gradle version and is your android studio also in the latest state, follow this thread and also update your question with the project's build.gradle file
https://stackoverflow.com/a/37091489/1503130

Related

Plugin with id 'io.fabric' not found once generating android project from Ionic

I am trying to generate Andriod project from ionic using capacitor but I always get this error:
Plugin with id 'io.fabric' not found
I did not add any plugin to ionic project. I used only below commands:
ng build
ionic capacitor add android
npx cap open android
then once andriod studio get opened, I get this error:
Plugin with id 'io.fabric' not found
Any idea how to fix this.
Could you please show us your build.gradle (app) file? And what is your Android Studio version?
Check if there is any dependencies with io.fabric and delete the line
dependencies {
classpath 'io.fabric.tools:gradle:...'
}
Also, in your build.gradle for app module, check if there isn't a line like this and delete it :
apply plugin: 'io.fabric'
Are you using Crashlytics?
In your build.gradle files, delete lines associated to crashlytics or io.fabric

WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'

Unable to resolve this warning. How can I resolve this?
variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with
variant.getExternalNativeBuildProviders()
Just update Fabric gradle plugin to 1.28.0
dependencies {
classpath 'io.fabric.tools:gradle:1.28.0'
}
Add this android.debug.obsoleteApi=true to the gradle.properties file. And make gradle clean, sync and then build an APK. Worked for me. I have Android Studio 3.3 and Gradle version 4.10.1.
For more information check this link out: Android Gradle plugin release notes.
I agree with other contributors: Fabric causes this error.
UPDATE
Check Valdislav Panchenko's answer:
Now you can just update your Fabric plugin to 1.28.0 as follows:
dependencies {
classpath 'io.fabric.tools:gradle:1.28.0'
}
Most likely it's caused by Fabric's plugin needed for Crashlytics.
Commenting out apply plugin: 'io.fabric' resolves the issue. So the only option is to wait until Google devs will fix Fabric's plugin.
It's caused by one of the Gradle plugins used in your project.
Check build.gradle file and try to remove apply plugin: xxx one by one to understand exactly which plugin is causing the warning.
In our project it was apply plugin: 'io.fabric' after Google update Android Studio to 3.3 yesterday.
It happened to me but I needed to continue with the Fabric plugin.
For those who need to keep the Fabric plugin applied, the temporary solution is to go back to the previous version of the gradle at the project level.
Change the classpath version to com.android.tools.build:gradle:3.2.1.
For those who are facing this problem eventhough they dont use fabric, forget about Vitaly Zeyenko's updated answer above and simply go to the gradle folder of your project and open the gradle.properties file and add this line -->>> android.debug.obsoleteApi=true to it...
After that, Clean and rebuild project... This is a better solution than on the command line because a lot of people already have the JDK environment set to wrong locations on their computer and might face more problems solving this issue through the command line

cannot apply 'android-reporting' in gradle file

When I put apply plugin: 'android-reporting' in my project level build.gradle file as suggested here, gradle sync fails throwing
Caused by: java.lang.IllegalArgumentException: Cannot add extension with name 'android', as there is an extension already registered with that name.
Can somebody help what could be happening here. I am at latest version of gradle plugin.
You need to apply it at the end of the root build.gradle
I ran into this issue from applying an android plugin via an allPlugins block. If you change this to subprojects it might fix your issue

Fabric plugin incompatible with Gradle 4.4 +

Recently I have had to update my project to use Gradle 4.4 from 4.1.
i.e.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
in my gradle-wrapper.properties file.
However, this is incompabitble with the fabric plugin
apply plugin: 'io.fabric'
As since the gradle update, I now get build errors when syncing my project.
Such as:
Error:Could not get unknown property 'manifestFile' for task
':Module:generateVariantFlavorRFile' of type
com.android.build.gradle.internal.res.GenerateLibraryRFileTask.
Does anyone know when/if there will be a new plugin update that is compatible with gradle 4.4+?
So my project included feature modules, where in the the base module's build.gradle, I apply the fabric plugin. i.e. apply plugin: 'io.fabric'
It turns out that gradle version 4.4 + does work but you need to add the following:
crashlytics { instantAppSupport true }
in your base module's build.gradle. I didn't actually have an instant app, but even with feature modules in appears that this line is needed.
More info on how this can be added can be found here:
How do I integrate Crashlytics with Android Instant Apps?

Can not add com.github.dcendents.android-maven

I tried to upload my code to bintry so that I can connect it to jcenter but the problem occurs when I add this line to my library build.gradle:
apply plugin: 'com.github.dcendents.android-maven'
gradle can not be build, what did I wrong?
I had the same issue. I was using gradle 2.4.
I don't know why but by downgrading gradle to 2.2.1 it get solved.
Just go to File then Project Settings and write in gradle field 2.2.1.

Categories

Resources