Unable to build titanium android module with ant - android

I am trying to build module with ant. I am getting below error message.
BUILD FAILED
/Users/XXXX/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/module/android/build.xml:163: /Users/XXXX/Documents/titanium-test-workspace/holograph/lib does not exist.
Path to module repo : TiHoloGraph
Settings in my build.properties are
titanium.platform=/Users/XXXX/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android
android.platform=/Users/XXXX/Documents/android-sdk-macosx/platforms/android-19
google.apis=/Users/XXXX/Documents/android-sdk-macosx/add-ons/addon-google_apis-google-19
android.ndk=/Users/XXXX/Documents/android-ndk-r1
any help?

I've had the same problems with building modules.
Somehow ANT cannot create a lib folder in MacOS.
Just create a /Users/XXXX/Documents/titanium-test-workspace/holograph/lib folder yourself and you'll be fine

Related

file or directory '<project>/<app>/src/debug/java', not found

My project doesn't build. I imported a third party project with library and sample module into Android Studio.
The project is here https://github.com/consp1racy/android-support-preference.git
Both modules have Build Variant set to debug. When I build the project it fails on the sample module with error message:
file or directory 'project/sample/src/debug/java', not found
Setting the build variant of sample module to release produces a similar message:
file or directory 'project/sample/src/release/java', not found
I'm puzzled. I would expect the source path to be src/main/java.
What is going on here?
The original author of the project made an update and now it builds fine with gradle from the command line.

Vuforia-Samples in Android Studio Error

I load the Vuforia project into Android Studio and get this Error-Message:
Migrate Project to Gradle?
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
+
Error running build: Cannot find script C:\Users...\vuforia\v2\samples\app\build.gradle
Actually the build.gradle file is in this folder.
I followed these Steps:
Close your project
Back up your project
Delete the .idea folder in the root directory of the project
Delete all the .iml files in your project
Import your project in Android Studio, and in the dialog that prompts you for a file, choose the build.gradle file.
,but not successfully.
Sorry for my bad english.

Unable to generate Gradle files

I have imported a project from GitHub into Android Studio, however there is not a gradlew nor gradle.bat file.
I read about how I could generate them from questions like this one, so I ran the following command in the terminal:
gradle wrapper
However, I was given an error:
'gradle' is not recognized as an internal or external command,
operable program or batch file.
Also, in Android Studio, I have set the following setting:
Build, Execution, Deployment > Build Tools > Gradle [For current project]
...
Project-level settings
[x] Use default gradle wrapper (recommended)
[ ] Use local gradle distribution...
...
So my question is, how can I resolve the error and generate the gradlew and gradle.bat files?
It seemed as though in my case, I had deleted gradle wrapper files (I was trying to edit my GitHub project by importing it to Android Studio, and I had deleted the original files that I uploaded. I accidentally put in .gitignore to not upload those files to GitHub so they weren't there when I imported the project). I found them in my recycle bin and restored them.

Android test project fails to build under Ant, OK in Eclipse

I am trying to set up a CI build server for an Android app project and its JUnit test project. I've generated the appropriate build.xml files for both app and test projects.
Both projects build and execute fine under Eclipse.
However, when I try to do ant debug on the test project without having first built both projects with Eclipse, I get several [javac] errors saying error: cannot find symbol which refer to classes in the app project.
I think this is a difference between the classpath that Eclipse sees and the classpath that Ant is using...
How do I tell Ant where to find the app classes?
It seems the Android default build.xml defines all the targets, so I was wondering how to insert the appropriate reference in the app project's build.xml... rather than having to start the build file from scratch.
Tried exporting the Ant build file from Eclipse; that fails to build either project.
What seems to work is to re-run:
android update test-project -m ../../app_project/ -p .
within the test project.
The only change it made was to create an ant.properties file with one non-comment line:
tested.project.dir=../../app_project/
And now it all works swimmingly outside of Eclipse!

Adding android library project to an android project prevents Ant from building

I'm adding an android library project to my android app (in this case, Beintoo). It's not mine; It's an external library. However, it doesn't come with a build.xml. Building in Eclipse works fine, but when I attempt to build my app with ant, I get this:
BUILD FAILED
C:\Sandbox\MyProject\build.xml:110: The following error occurred while executing this line:
C:\Sandbox\MyProject\build.xml:41: The following error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:515: Invalid file: C:\Git\Beintoo-Android\beintoo-android-sdk\BeintooSDK\build.xml
It's perfectly true. The file is invalid, because it doesn't exist. I wouldn't know what to do to add it safely, nor if that's even a good idea.
I have learnt that I can't simply build the library project into a jar. How can I get my project to build in Ant with this library project?
Ok, so, Error 454's answer was close, but not quite right. Since r14 of Android Tools, every library project must have it's own build.xml if it is to be built by Ant, as noted here:
https://groups.google.com/forum/?fromgroups#!topic/adt-dev/Z2e3dY-3Ma0
Running android update lib-project (which, as Error 454 notes, is in the android-sdk/tools folder which should be in PATH) on the library project will add a generic build.xml, and allow the main project to build.
For library projects, you need to browse to the library project root and run:
android update lib-project -p .
The android executable is in the android sdk/tools folder which should be added to your path variable in your OS. Once you run this, the necessary build files will be generated and your ant build should succeed.
Similarly, if your root project doesn't have the necessary build files, you will need to browse to the main project root and run:
android update project -p .
Additionally to the two previous correct answers I had to add --target android-16 because I was getting an "Error: The project either has no target set or the target is invalid."
So in my case
android update lib-project -p . --target android-16
Did it. (replace the 16 as you need)

Categories

Resources