I would like to build and android project from command line on Linux. In the root directory of the project there are the following files and directories:
AndroidManifest.xml build.xml default.properties res/ src/
Can you provide a sample Makefile how to build this project?
Do you have 'ant' installed? Try ant debug
The build.xml file is input to the Ant program, which will build your project. Use "ant build"
Related
I moved my Android SDK (and NDK) when my hard drive failed.
In my working project, I updated local.properties to reflect these changes in the variables ndk.dir and sdk.dir, yet when I run ./gradlew clean --info on the command line from within my project directory, gradle gives me a failure at the following command:
<old_ndk_path>/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=<oldprojdir>/app/src/main/jni/Android.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-23 NDK_OUT=<oldprojdir>/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=<oldprojdir>/app/build/intermediates/ndkBuild/debug/lib clean
It's no wonder that the task fails, since no executable exists at that path now, but how can I get gradle to make use of the new NDK path? And how can I make it use the new project directory?
Delete the <projdir>/.gradle directory and try again.
I use android studio with ndk and opencv. By default ndk-build command builds files under src/main/libs folder . I want to change it to src/main/jniLibs.
Add the option NDK_LIBS_OUT=<library output path> for ndk-build.
I'm trying to build an apk file from command line. I created a sample project usng the following command:
android create project --target 1 --name MyApp --path ./MyProject --activity MyActivity --package com.example.myapp
Which created the following structure:
/bin
/res
/src
/libs
AndroidManifest.xml
ant.properties
build.xml
local.properties
proguard-project.txt
project.properties
Now when I try to build the project, I get:
$ gradle build
gradle will not execute and completion _gradle exists.
I couldn't find any info on this error, so I ran:
$ _gradle build
_arguments:comparguments:312: can only be called from completion function
user has logged on pts/7 from :0.0.
Any hints on what am I doing wrong? Thanks!
android create project creates project in structure expected by Eclipse, not gradle based (Android Studio) projects.
I was able to build the apk using the following lines:
ant debug
adb install bin/HelloWorld-debug.apk
I downloaded the ActionBarSherlock ViewPagerTutorial from here:
http://www.androidbegin.com/tutorial/android-actionbarsherlock-viewpager-tabs-tutorial/
But when I try to build the package it errors out saying:
$ ant debug
Buildfile: build.xml does not exist!
Build failed
Where can I find the build.xml file for this package?
Where can I find the build.xml file for this package?
You create it, by running the android update project command.
i want to know how can we generate apk file using ant script. i came to know that we can use "ant debug" command to do that.but when i am running this command it is returning error that " Target "debug" does not exist in the project". i am using ant1.7.0.is it the issue?i have tried given below code to generate apk.
<target depends="build-subprojects,build-project" name="build">
<jar destfile="bin/test.apk" basedir="bin/classes" >
<manifest>
<attribute name="Main-Class" value="test.Main" />
</manifest>
</jar>
</target>
but the generated apk is different from auto generated apk while build the app using eclipse.Please guide me.
but when i am running this command it is returning error that " Target "debug" does not exist in the project"
Then you did not create your Android project properly, or you modified your build.xml file, or something else is broken.
As a test, I just ran the following command from my /tmp directory on Linux:
android create project --target android-17 --path Foo --package com.foo --activity Foo
I then changed into the Foo directory and ran ant debug. The app compiled, and in my bin/ directory is Foo-debug.apk.
If you are not getting this sort of result, delete your build.xml file and run android update project --path ..., where ... is the path to your project, to create a fresh build.xml file.