First, im new in gradle so please bear with me.
I successfully build and imported this project with gradle & eclipse on ubuntu 13.10. This is what i did :
run gradle build in terminal (success)
add apply plugin: 'eclipse' in the build.gradle
run gradle eclipse in terminal (success)
import it as existing project on eclipse
The problem is, when i tried to run the project, eclipse read it as "normal" java program, not the android one. This is the SS :
The main project in my workspace is not in eclipse format.
And this is its properties :
Notice there's no android tab in it's properties. And i cant run it as android application.
Am i missing something? Please kindly help me.
Thanks for your help.
Usually to develop Android in Eclipse you need to install ADT into Eclipse or start with ADT-Bundle (Android IDE) from Google. (You have not as Preferences missing Android group)
However ADT does not have gradle support. And Android Studio is still not even yet beta (preview or alpha, bleeding edge, need to update with almost every build).
There is Nodeclipse/Enide Gradle for Eclipse
(marketplace), that lets launch gradle build even on general project.
For the latest build.gradle template for classic Android project check
gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.
This lets create new Android project in Eclipse with ADT and use ADT tools for most of things,
but additionally have newer build with gradle
and execute defined gradle tasks
But for Android project with several modules (as in this case) you would need to DIY do it yourself:
try to configure Eclipse .classpath to correct values, as gradle eclipse task won't yet do it all for you.
Eclipse plugin in Gradle that you have used does not support Android projects - they are significantly different from regular Java projects. Some things can work but there will be a lot of things missing including Android nature for generated projects.
And the ADT plugin provided by Google does not support Gradle projects yet as the team focuses on Android Studio first. http://tools.android.com/tech-docs/new-build-system can give you some ideas about the current state.
Related
I have gone through similar question on the internet. But I am still unable to find a solution for it.
To begin with I am trying to understand gradle and how android studio builds gradle files.
I have read about gradle and how it is structured. I have understood that it is similar to make in linux, so it builds all of the necessary files to create apk. But i could not understand how android studio generates all the gradle files. Is there a main file which is executed and which generates all of the other gradle files.
My project was working properly until i had to sync the gradle files and now it is giving me "Gradle project sync failed" error. I have tried out existing solutions on the internet, like
1.Invalidating caches and Restarting
2.Settings -> Build, Execution, Deployment -> Gradle turning on Online mode here, which i could not find on the android studio version 4.0.1
3.Opening up Gradle build console from View -> Tool Windows -> Gradle which i could not find.
I can't see the module level and project level gradle files amongst others, should I manually add them?
Should i download a new gradle file and point it separately? Is there any way to fix it by executing the right gradle file and generating the rest of it.
Where can I read more about it and have a better understanding of gradle.
Better install a new version of android studio. i think you have updated your gradle plugin.
I had that problem and I just updated my Android studio. It worked!
go to: Help->Check for updates
I am starting at a disadvantage as I know neither Eclipse, Gradle or Android Studio. As such, I may not be using the correct terminology for everything, but I'll give it a shot. My ultimate goal is to get a working Eclipse-based Android app imported into Android Studio and hand it back to the Android developer. This question is about a problem I encountered on the way.
I have successfully imported the main Android project into AS. Now I'm trying to pull in another project it depends upon as a module. The dependency is a Maven project. It has a pom.xml, a .project and a .classpath. It's not an Android project, so there's no AndroidManifest.xml. It has a src but no res folder. I want this project to be a module rather than an external dependency as the developer will modify the source code on occasion.
The problem is that AS refuses to accept the project as an importable module. The Add Module dialog, when pointed to the project's root directory, continues to warn that I haven't yet selected a valid Android Eclipse or Gradle project. The Next button stays grayed-out. I agree that this is neither an Android-specific nor a Gradle project, but I have read here that IntelliJ IDEA will import such projects. It appears that AS will not.
There are several other non-Android Eclipse projects that also won't import as modules in the same way. These include ordinary Maven and ant-based libraries.
How do I accomplish this? The GUI seems out to thwart me. If I get down to the Gradle XML level, can I do it and will the modules show up normally in the GUI? Do I have to go back to Eclipse and convert these to Gradle projects first?
Thanks in advance.
I want to migrate from Eclipse to Android Studio, but unfortunately Eclipse was crashed so I couldn't build gradle-build files, so I reinstalled Eclipse, and luckily I still had those, I copied my old files which where in my old workspace (the workspace from before the crash) to a new workspace.
But, when I build the gradle-build files now and I import them in Android Studio it says my gridlayout_v7 is missing.
Does anyone of you know how I can solve this?
Run SDK Manager and check that you have installed:
Android Support Repository
Android Support Library
Google Repository
Then check if your build.gradle has next lines:
dependencies {
compile 'com.android.support:gridlayout-v7:18.0.0'
}
You dont need separate gridlayout library subproject anymore with new build system.
I created a fresh project in Android Studio which uses external library (JAR). I put this in modules's build.gradle:
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/mylib.jar')
}
But, when using Android Studio editor, it says there are some errors in my code and marks imports and variables (which use this library). It doesn't build properly saying that it cannot find one or another class. However, when I go to project's directory in terminal and execute gradlew manually, it builds APK and it (the APK) install and works just fine.
What am I missing? Is there any another setting in my project which is used for library detection?
Android Studio currently does not automatically sync your Gradle build files with your Android Studio (.iml) files. However, version 0.1.3 added a new sync button to the toolbar that will do this manually.
It's mentioned in the second bullet point of this blog post.
There were a lot of fixes in the Gradle project import and build
areas. There is now a "sync" button in the toolbar which will reimport
the Gradle project state into your Android Studio project. Use this
after editing your Gradle files, for example to add a library. In the
future we will more automatically handle state syncing, but for now
this is the simplest way to keep the IDE up to date with project
structure changes made to the Gradle files.
Is it necessary to download and install ADT plugin into Eclipse, if I want to build all projects using maven?
You might be able to get your project to build by just relying on maven, but you'd miss out on debug tools, Android-specific editors, the simulator, the ADB shell...
For a mavenized android project, if you are talking about build project from commandline, for instance, check out some projects from GitHub and do a mvn clean install, you only need install and setup:
Android SDK
Maven
If you are talking about develop/build project inside IDE like Eclipse, besides Android SDK and Maven, you need the following Eclipse plugins (all available via Eclipse Marketplace), in order to create/import and work on mavenized android project inside Eclipse:
adt
m2e (Maven Integration for Eclipse)
m2e-android (Android Configurator for M2E)
Check out answer here and see screenshot of installed Eclipse plugin.
the ADT plugin is required as It holds the APIs though I am not familiar with maven It would probably be a good idea to install the android ADT to get these APIs. also included in the ADT is the system images and java files needed to build on to create an app.
as I said I am not familiar with maven but I would still recommend installing android ADT