Generating eclipse project from android gradle plugin - android

i could build a gradle project using android plugin. I would like to know if we can generate a valid eclipse android project? I added the below
apply plugin: 'android'
apply plugin: 'eclipse'
when i say: gradle eclipse i get
E:\proj\Platform2.0\mobile\Android\Common>gradle --build-file adt_build.gradle eclipse
The TaskContainer.add() method has been deprecated and is scheduled to be removed in
Gradle 2.0. Please use the cr:eclipseClasspath
:eclipseJdt
:eclipseProject
:eclipse
BUILD SUCCESSFUL
but when i import the genrated project in eclipse... it doenst have the jar files imported by gradle from dependencies.
Any ideas?

I feel like my response may be short of a true answer, but hopefully it qualifies under "Any ideas?" Anyhow...
It's hard to know without seeing more of the gradle file, but I find the warning gradle is giving you to be quite suspicious. TaskContainer.add() doesn't really jump out at me, but the suggestion does.
Please use the cr:eclipseClasspath
Now obviously deprecated doesn't automatically mean "this won't work" but gradle is suggesting you use cr:eclipseClasspath and it sounds like you are having issues with the eclipse classpath. It's hard to assume the warning and your issues are not related. Have you done any investigation along that route?

see Is it possible to use the Gradle build system for Android with Eclipse?
As of April 2014 eclipse-gradle plugin is not compatible with android-gradle plugin
so having both
apply plugin: 'android'
apply plugin: 'eclipse'
is wrong start.
Eclipse files are to be added manually as described at Importing from Android Studio into Eclipse

Related

React Native: What's the difference between gradle references in gradle-wrapper.properties and build.gradle?

In my React Native app, I got an error about incompatibilities with gradle 6, so I looked in my project structure to find out which version of gradle I was running in my project. I found this line in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
and this line in build.gradle
classpath("com.android.tools.build:gradle:3.4.2")
What I Want To Know: What's the difference between the reference to gradle in each of these files? In other words, how is version 5.5 being used in my project, and how is 3.4.2 being used?
distributionUrl represents Gradel Version where as classpath represents Android Gradle plugin version.
Gradel vs Android Gradle plugin: Reffer this difference between android gradle plugin and gradle
Gradle is the build system.
You can use it with a lot of plugins. One of these is the plugin for Android.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.
For greater details and mapping of the above two type of versions refer the following URLs
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
https://developer.android.com/studio/releases/gradle-plugin#updating-plugin
I hope this answer has cleared your doubts.

I started a new Kotlin Android Project but I got this error - "Expected a single classpath entry, found: []"

I am using the latest version of android studio, with Kotlin. Anyone with a solution will really appreciated
https://i.stack.imgur.com/kkRm1.png
Plugins are missing, something like that
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
None of those work for you?
If you have ever changed where android is stored (i.e. saving gradle or APK files on an external drive) this may help.
Expected a single classpath entry, found: []
I had this error but my real problem was very different. Before I upgraded my storage, I used an external drive to host Android APKs and gradle files.
I had promptly forgotten this earlier when beginning a new project, no longer using the external drive!
I went into File -> Settings -> Build, Execution, Deployment -> Gradle -> emptied the "Gradle User Home" so it points back at default.
Fixed! Maybe this will help someone... another example of an error that really didn't reflect the problem.
This is because your project is still using the previous project gradle. Open Android Studio, go to File ->Settings->Build,Execution,Deployment->Gradle user home: and select the correct gradle folder (the one which is reside in your current project folder).
Hope this will work for you
I also faced the same issue and this solution work for me after trying many other ways.
I went into File -> Settings -> Build, Execution, Deployment -> Gradle -> claer the "Gradle User Home" at top and save changes.
After that i have updated my Gradle version from 6.5 to 6.7.1 and sync project.
It works fine.
For me deleting gradle caches worked.
I am using macos, my user was joanne.
So the path to gradle cache was
/Users/joanne/.gradle/caches
I deleted everything inside that folder, the error went away

Android Studio: Can't sync Gradle Project

I am currently experiencing a strange issue with Android Studio and Gradle.
Android Studio: 3.4.2
Gradle: 2.10
When I try to sync the Android Studio Project the sync finishes in 969ms with CONFIGURE SUCCESSFUL followed by a red 1
Here is Android Studio's IDEA log
It looks like there is some kind of exception, but I can't figure out why.
Another interresting thing is that I can execute ./gradlew build --info without any issues.
The logs without the build.gradle is useless information ...
and one cannot use Gradle 2.10 with Android Studio 3.4.2
... you'd have to upgrade at least to Gradle 5.1.0.
I just stumbled over a solution by googling some of the log content.
Adding com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
after apply plugin: 'com.google.gms.google-services'
It just works!
Here is the original post: https://stackoverflow.com/a/54504968/1766321

Firebase performance monitor causing "D8: Unsupported source file type"

I added
apply plugin: 'com.google.firebase.firebase-perf'
and when I ran build script I got
/transforms/FirebasePerformancePlugin/dev/debug/174/module-info.class:
D8: Unsupported source file type
What kind of problem it could be?
I updated all plugins, play services, and Android Studio, but with no luck
I Solve This issue by updating gradle version
classpath 'com.android.tools.build:gradle:3.5.3'
Update: Android Gradle Plugin 3.5.0 fixes this. See this issue and this one issue, both fixed.
(Unfortunately, in my project, this other issue still remains even in 3.5.3.)
I started getting the same error after updating a (company internal) library dependency, but then I kept getting it even after reverting that update. Very strange!
> Task :app:transformClassesAndResourcesWithR8ForBetaRelease FAILED
R8 is the new Android code shrinker. If you experience any issues, please file a bug at
https://issuetracker.google.com, using 'Shrinker (R8)' as component name. You can
disable R8 by updating gradle.properties with 'android.enableR8=false'.
.../transforms/FirebasePerformancePlugin/beta/release/66/module-info.class:
D8: Unsupported source file type
The only thing I found that helped was to do what the Gradle build output says and temporarily switch back to ProGuard, with:
android.enableR8=false
in gradle.properties.
This issue was fixed somewhere between Android Studio 3.5 Beta 2 and Android Studio 3.6 Canary 5, there were a bunch of similar issues with module-info.class.
In my case to fix issue I had not only update Android Studio, but also update gradle plugin.
Steps is:
Install new version alongside your stable version (You also can configure current version to use updates from canary chanel)
More info here
Download link (I downloaded 3.6 Canary 5)
After you installed new Android Studio update grade plugin:
in
gradle/wrapper/gradle-wrapper.properties
chande distributionUrl to
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
Don't forget Build->Clean Project
Turn off Firebase-performance plugin.
Android Studio 3.6 Canary 1 has this issue too.
I didn't find another way to release build my project.
i solve this problem with 3 steps:
1.update the "distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip"
2.update the "classpath "com.android.tools.build:gradle:3.6.3"
3.update the Studio 3.6.3
in other way(i don't like it)
//apply plugin: 'com.google.firebase.firebase-perf'
...
//classpath "com.google.firebase:perf-plugin:1.3.1"

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

Categories

Resources