I am having trouble building my Android library project with ant. When I try to run ant release, it says Target "release" does not exist in the project "MyProject".
I then assumed that perhaps libraries do not get build with release/debug, so I started using ant compile, which seems to work. I then zip the folder manually using java's zip utility and rename it to .apk. I am guessing this is the wrong way to do this.
Can anyone show me how to build an Android library project using ant?
I then assumed that perhaps libraries do not get build with release/debug
Correct.
I am guessing this is the wrong way to do this.
Also correct.
Can anyone show me how to build an Android library project using ant?
You typically do not build an Android library project. You build other projects that reference the Android library project. Creating projects that reference the library project, for use with Ant, is covered in the Android documentation. More information about the role of Android library projects can also be found in the Android documentation.
I had the same trouble with a target "nodeps" that was not known by Ant when building a project that was referencing a library. I added a fake target "nodeps", then I get the target "release" unknown. Wrong way.
Solution : in my referenced library directory, I run the command android update project -p . that created the build.xml compatible with Ant build.
Related
I have an Android project for a library (using the com.android.library plugin), that includes C++ code. When I run the assemble task in gradle, the outputted AAR contains the native library in the /jni folder. However, there is no "prefab" folder. The only documentation I can find about creating Android libraries is here: https://developer.android.com/studio/projects/android-library
The bottom section suggests that the /prefab folder should be there.
I can find information on how to set up a project to import prefabs from an AAR, but I can't find any information on how to build an AAR with prefab exports. Is there a way to set up an Android project with gradle to do this? Are there settings I have to add to specify which native libraries should be exposed?
I'm using Android Studio 4.1.1, gradle 6.8, and Android gradle plugin 4.1.1.
This is covered by the samples. Not sure where it is in the docs, they definitely used to be on DAC. https://github.com/android/ndk-samples/tree/main/prefab/prefab-publishing
i am trying to add this project "https://github.com/47deg/android-swipelistview" into my project. I tried to add it to my workspace as a lib project but eclipse wont let me add the folder to my workspace.
You need to know, how to build Android Applications with the Gradle build tool. This needs some Prerequisites such as Apache Ant and Gradle.
Here is a good toutorial - http://www.vogella.com/tutorials/AndroidBuild/article.html
Before importing the library, complete an example using gradle. Then surely you'll know, how to do this one.
I have a simple Android library project, which contains network calls functionality only. It doesn't need to inherit any XML/resources etc… to calling application. When I build this project using Eclipse IDE (right click on project and click on Build Project), it generates a JAR under bin/libproject.jar. I can simply drop this file to any project's build path and it works fine.
Now, I want to implement continuous integration for my library. That means, I need some command-line way to achieve the same (building jar, when I build the project using ant). Ant builds the project differently. It creates classes.jar in bin/ folder, which is not the same as as libproject.jar.
I believe Eclipse's Build Project (ADT rev-21) is doing something magical to build this complete JAR for my library project (this is more like a java project like JAR).
Do you know how can I achieve the same using command line?
im using eclipse 4.3 w/ ant and with sdk tools 21.1
IMO - they recently changed the sdk regarding lib dependencies.
http://tools.android.com/recent/dealingwithdependenciesinandroidprojects
see the above link.
my example lib dependency(transitive) as follows:
ABS <== SlidingMenu <== MyProject
so, in SM.project.properties...
android.library.reference.1=../../src/ABS/library
and, in MP.project.properties ...
android.library.reference.1=../../src/SlidingMenu/library
The ant build, run on proj=SM using either eclipse internal, ant build tools OR ant on CLI in a terminal session outside eclipse
does following:
[javac] Note: Recompile with -Xlint:deprecation for details.
[echo] Creating library output jar file...
[jar] Building jar: /home/rob/src/tools/ActionBarSherlock-4.2.0/library/bin/classes.jar
and ant build, run on proj=MP does the following:
Setting project property: out.library.jar.file -> /home/rob/src/SlidingMenu/library/bin/classes.jar
..
[jar] Building jar: /home/rob/src/SlidingMenu/library/bin/classes.jar
IMO - you should focus on 2 things :
get the lib reference correct in the file=project.properties of the dependent.
double check in eclipse the project /properties/ java build path / order and export
read the link as it contains multiple , specific NOTEs relating to 'order export'...
When you build the dependent project in ant , it should trigger internally, builds of the other projects. I think that is controlled in the build path of the dependent project.
An additional NOTE on debugging - i could not debug directly from the project explorer because the launcher did not like the "classes.jar" for the 2 , dependent projects. Debug insisted on there being jars with names "${project-name}.jar" in the ./bin directory of each library. But ant assigns "classes.jar" as shown above.
So, to debug, i used the alternate method of DDMS tab in eclipse w/ the app already running. then u find the process and attach the debugger.
I have just set-up my local jenkins installation on my mac...
Now i have tried to create an ant built which builds my app as soon as i check-in a new change. The ant script is working great as long as i only use it in the project...
cd into the folder
ant release
It is able to find all library projects i'Ve included (ActionBarSherlock, ViewPagerIndicator, NineOldAndroids, HoloEveryWhere, PocketChange)
As soon as i put this on my jenkins installation everything breaks.
My main folder-organisation is like this:
Projects/Project
Projects/ProjectLibrarys/Library
Eclipse referes to those libraries like this: android.library.reference.2=../Project Librarys/ActionBarSherlock/library
I can't use absolute links (because i think they will fix the issue) but eclipse or ant doesn't like them.
I have really no idea how to fix it?
Will i have to edit the build.xml (i've added it into the folder ext/commonbuild/commonbuild.xml so i have the same android build file for all my projects)
If you need more code let me know.
Thanks in advance...
Ok i was able to solve my issue by adding a customproject.properties file with a seperate link for the build.
There is still one issue. It seems that ant doesn't use the customproject.properties for my library project i've added. This library project includes another library project and as soon as i build it has a wrong relative url.
Does someone know how to use the customproject.properties even for the project libraries?
As bluszcz mentioned, I checked out two modules and i was able to build my apk via Jenkins without having two project.properties or customproject.properties file.
On Jenkins Configure Screen, Under Source Code Management - Subversion Modules,
Give the url for your android project (say, SampleAndroidProject)
https://goxxx.com/svn/repository/projects/trunk/SampleAndroidProject
Provide local module directory as 'SampleAndroidProject'
Provide the svn url for your library project (say, google-play-services_lib)
https://goxxx.com/svn/repository/projects/trunk/google-play-services_lib
Provide local module directory as 'google-play-services_lib'
Save and build again.
I'm trying to build my project using ANT. My project uses ActionbarSherlock, and Roboguice-Sherlock. ActionbarSherlock is an Android library project, but Roboguice-Sherlock is not. It's not even an Android project at all. See here:
https://github.com/rtyley/roboguice-sherlock
I can get ActionbarSherlock to build using ANT no problem, the problem lies with Roboguice-Sherlock. It's not an Android project, yet it has dependencies on Android and ActionbarSherlock, as well as Roboguice. When I try to build I get a ton of errors saying it can't find the Roboguice-Sherlock stuff.
If your project has the Roboguice .jar and the library project reference to ActionBarSherlock already configured you should be able to just drop it into your libs/ folder to have it automatically picked up.
I am working with Roberto to ensure that the .jar of his project gets uploaded to GitHub for non-Maven users to use.
For now, you can clone the project simply run mvn clean package to get a standalone .jar in the target/ folder which will enable you to do as I described above.
You need to add robiguice-sherlock as a .jar to your Android project. You can download it here (click Download (JAR)). Trying to build the source in Android will fail because it is not an Android project. Once it is in your directory, you need to open project properties and add the .jar to your build path.