You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: org.nodeclipse.enide.editors.gradle/README.md
+98Lines changed: 98 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,104 @@ and [src/org/nodeclipse/enide/editors/gradle/highlight/Words.java](src/org/nodec
10
10
11
11
Read first at <http://www.nodeclipse.org/projects/gradle>
12
12
13
+
### AAR
14
+
15
+
Taken from <http://stackoverflow.com/questions/16709305/add-dependencies-via-gradle-to-eclipse-in-android-project?rq=1>
16
+
17
+
My solution is based off Rafael's above in that it copies dependencies to the libs directory which is only used by Android. However I go further to completely explode the referenced AAR's for use in Eclipse.
18
+
19
+
#Gradle Build File
20
+
21
+
Add the following to the end of your Android projects build.gradle :
22
+
23
+
task copyJarDependencies(type: Copy) {
24
+
description = 'Used for Eclipse. Copies all dependencies to the libs directory. If there are any AAR files it will extract the classes.jar and rename it the same as the AAR file but with a .jar on the end.'
25
+
libDir = new File(project.projectDir, '/libs')
26
+
println libDir
27
+
println 'Adding dependencies from compile configuration'
You should find all dependencies and exploded AARs in your libs directory. This is all Eclipse should need.
84
+
85
+
# Importing in Eclipse #
86
+
Now this is where the real benefit begins. After you've generated the libs directory from the gradle step above you'll notice there are folders in there too. Those new folders are the exploded AAR dependencies from your build.gradle file.
87
+
88
+
Now the cool part is that when you import your existing Android project into Eclipse it will also detect the exploded AAR folders as projects it can import too!
89
+
90
+
**1.** Import those folders under your project's **libs** directory, *don't import any 'build' folders, they're generated by Gradle*
91
+
92
+
**2.** Ensure you perform a ***Project -> Clean*** on all AAR projects you've added. In your workspace check that each AAR exploded project has the following in the project.properties :
93
+
94
+
target=android-<YOUR INSTALLED SKD VERSION GOES HERE>
95
+
android.library=true
96
+
97
+
**3.** Now in your main Android project you can just add the library references with either ADT or you can just edit the project.properties file and add
**4.** Now you can right-click on your main Android project and **Run as -> Android Application**.
102
+
103
+
104
+
#But what does this even mean?
105
+
1. Well it means you don't need the source code for any of your Android AAR Gradle dependencies in order to reference both it's classes and resources in Eclipse.
106
+
107
+
2. The gradle build script above takes the AAR file and prepares it for use in Eclipse. Once you add it to your workspace you're ready to just focus on your actual main Android project.
108
+
109
+
3. You can now debug and develop using Eclipse and deploy using ADT with AAR dependencies being properly bundled in the APK. When you need to make some specific builds then you can use gradle.
110
+
13
111
## To Develop
14
112
15
113
- Import `org.nodeclipse.enide.editors.gradle` as existing Eclipse project in Eclipse with PDE (e.g. Eclipse Standard or Enide Studio)
0 commit comments