Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing gradle project to eclipse

I have problem with importing this library into eclipse. Things I did:

  • run gradlew.bat (inside project) that downloaded and installed it
  • run CMD
  • set my SDK with command "set ANDROID_HOME=C:\dev\android-sdk-windows"
  • run command gradlew build
  • after successful build image I tried to import project into my eclipse but it's incomplete (without any classes)

It's first time I'm using gradlew, could you tell me what I'm doing wrong?

like image 739
user3140199 Avatar asked Dec 27 '13 18:12

user3140199


2 Answers

This library is built with Android Studio or Intellj. These steps with Gradle are referred to Android Studio or IntellJ.

I don't know this lib, but if you are using Eclipse, you should do:

  • clone a copy of this repository, or download it (outside eclipse workspace)
  • import the code in your workspace starting from library/Donation-lib folder
  • mark java(*) folder as source (click on folder -> Build-Path -> use as source folder). You can also remove the src folder, from the project.
  • mark aidl(*) folder as source
  • add support library v4 rel.XX ( click -> Android Tools -> Add support library , or just copy android-support-v4.jar in libs folder)
  • mark your project as Android Library (Properties -> Android -> Is library)

(*) Eclipse uses src and res as source folders.
Android Studio instead uses src/main/java , src/main/res and src/main/aidl as source folders.

like image 181
Gabriele Mariotti Avatar answered Sep 20 '22 12:09

Gabriele Mariotti


Open file build.gradle and add this line on top:

apply plugin: 'eclipse'

In project directory invoke command

 gradlew.bat eclipse

Open project in Eclipse (import) like normal eclipse project

More info: Eclipse Plugin

Alternatively use dedicated Eclipse plugin Gradle Integration for Eclipse 3.4.0.RELEASE

like image 21
MariuszS Avatar answered Sep 16 '22 12:09

MariuszS