Migrate an old project to Android Studio - android

I am new to Android Studio.
need to Migrate an old project to Android Studio
First I got this error :
android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor'..
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information ...
Then when I make the changes and replace what i need to i get this error:
'keyboard|screenSize|orientation|' is incompatible with ...
anyone having idea about this please help

For the android-apt error refer:
Incompatible plugins for android-apt after upgrading to Android Studio 2.3
Also, in your app gradle file, under dependencies section, change compile to implementation. (compile will be deprecated at the end of 2018, you should use implementation instead).
For the second one, it seems like (according to the image) that you have an extra | at the end (keyboard|screenSize|orientation|) try to remove it.
Next time please attach the code itself, it will be much easier to find what's wrong.

Related

Android Gradle Plugin: Property 'applicationId' is not annotated with an input or output annotation

I recently upgraded my Android Studio (and Gradle Plugin) to version 4.0, and now when I build my project I get:
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.
Then, when I set org.gradle.warning.mode=all in gradle.properties, I get this below :app:generateSafeArgsDebug task:
Property applicationId is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property applicationIdResource is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
I've read Gradle version 6.1.1 and plugin version 4.0.0 in android studio in Gradle Forums, which suggests that the problem could be caused by outdated dependencies, but I have all the latest versions and the problem remains.
How can I fix this warning?
"androidx.navigation:navigation-safe-args-gradle-plugin" is the cause of the "app:generateSafeArgsDebug" task.
By upgrading it (to the 2.3.1 version, for example), theses warnings will disappear.
Other warnings will raise:
WARNING: DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'.
It will be removed in version 5.0 of the Android Gradle plugin.
WARNING: API 'BaseVariant.getApplicationIdTextResource' is obsolete and has been replaced with 'VariantProperties.applicationId'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see TBD.
To determine what is calling BaseVariant.getApplicationIdTextResource, use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
But maybe easier to solve (and less stacktrace-styled)

WARNING: API 'variant.getMappingFile()' is obsolete and has been replaced with 'variant.getMappingFileProvider()'

I just updated Android Studio 3.5 to Android Studio 3.6 and replaced previous Gradle plugin with Gradle plugin 3.6.0 when syncing Gradle:
build.gradle: API 'variant.getMappingFile()' is obsolete and has been
replaced with 'variant.getMappingFileProvider()'
Any suggestions on how to debug this warning. Where is it coming from? I don't see any usage of getMappingFile in my code although, might be some library. Suggestions to debug these kind of cases would be helpful
Upgrading
classpath 'io.fabric.tools:gradle:1.29.0'
to
classpath 'io.fabric.tools:gradle:1.31.2'
in my top-level build.gradle fixed the problem for me.
When running the gradle script with the parameter -Pandroid.debug.obsoleteApi=true set, you can get a stack trace of what is causing the issue.
I found out it in my case was related to Crashlytics. There was this issue opened, but it's apparently the legacy-plugin so the issue has been closed again with a suggestion of contacting the Fabric support. So hopefully they will find a solution.
Go to build.gradle under Gradle Scripts
Add this Line: classpath 'io.fabric.tools:gradle:1.31.2'
Rebuild your Project.
If your project uses Firebase: instead of upgrading io.fabric.tools:gradle version it's better to switch to com.google.firebase:firebase-crashlytics-gradle since fabric is deprecated now. See Upgrade to the Firebase Crashlytics SDK guide for detailed instructions.
Maybe it could be of help to someone. In my case, it was:
variant.mappingFile
which was used in build.gradle to backup mapping files. To remove the warning use:
variant.mappingFileProvider

Android Studio and Gradle - seemingly misleading warning regarding testCompile, testImplementation, testApi

I get these two lines when compiling an old Android project using latest Android Studio (3.1.4):
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
I understand what they mean and how I can fix these warnings, there are also questions explaining it, but I can't any reference to 'testApi' anywhere on developer.android.com. Is it an error in warnings or was there testApi command? Was it added alongside 'testImplementation' and was later deprecated?
Previously we used testCompile but as per the last Gradle update Android Studio sometimes shows this messages though we edit the gradle file with new keywords.Now the "testApi" was not there in gradle as per my own experience.I think this error message is a fault.

Android Studio: still getting warning, need to update 'compile' to 'implementation'

Ok, I know this question has been asked over and over and its usually something simple within your own build config that you need to update. However, I keeping seeing:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. warning message.
I have already checked that I am using the latest of the google services:
'com.google.gms:google-services:4.0.1'
I've cleaned, rebuilt, invalidated cache with restart, and yet nothing changes. At this point my best guess is that this may be an underlying issue with 3rd party libs that I am importing. Could it be that they nay not be up to date with the implementation switch? Is there a way to find out which library would be the root cause, outside of me having to manually inspect each one of them?
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
This warning message is normal as you may be using a later version of Android Studio with android gradle plugin 3.0 or above.
compile, provided, and apk are currently still available. However, they will be removed in the next major release of the Android plugin.
See https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration for more details.
I found that the issue was a 3rd party lib/tool(s). The project I have inherited was including, but not actually using, Freeline Build Tool & Hugo. The moment I commented these out in both of the gradle files (project and app level) the warnings went away.

Firebase Performance configuration fails with v1.1.2 when using implementation or api

I'm trying to upgrade my firebase-plugins dependency version to 1.1.2 which supports the Android Gradle Plugin version 3+, but the Gradle build configuration keeps failing unless I use compile which is deprecated. I'm using Play Services version 11.4.2 and and I have the firebase-perf dependency added like so which fails:
implementation "com.google.firebase:firebase-perf:$playServicesVersion"
The only way to fix it is to change the above implementation to compile. Has anyone found a solution to get around this? (Aside from downgrading to firebase-plugins version 1.1.0-alpha1?)
Here's the error message:
* What went wrong:
A problem occurred configuring project ':app'.
> To use the Firebase Performance Plugin, the Firebase Performance Monitoring SDK must be added to the app's build.gradle. Please add compile 'com.google.firebase:f
irebase-perf:VERSION_NUMBER_GREATER_THAN_OR_EQUAL_TO_11.0.4' to the app's build.gradle.
Edit: this has been fixed in firebase-plugins:1.1.3.
This error is because firebase-perf plugin is specifically looking for the presence of 'compile' configuration for com.google.firebase:firebase-perf SDK. If the SDK is not included in build.gradle at build time, there will be a run time crash later.
Android Studio 3.0 replaces 'compile' with 'implementation', the plugin code should instead checking 'implementation' configuration for firebase-perf SDK.
The workaround now is to continue using:
compile "com.google.firebase:firebase-perf:$playServicesVersion"
This will be fixed in the future firebase-plugins release.

Categories

Resources