Building phone app from aosp - android

I'm trying to build just a phone app from aosp. I've configured my work dir as it was described in google's guide. Then i'm going to my work dir, execute source build/envsetup.sh and get the following:
including device/asus/grouper/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/armv7-a/vendorsetup.sh
including device/moto/wingray/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
Then i'm executing command mmm packages/apps/Phone/ and something goes wrong, i get
make: Entering directory `/home/build/WORK_DIR'
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/core_intermediates/javalib.jar', needed by `out/target/common/obj/JAVA_LIBRARIES/com.android.phone.common_intermediates/classes-full-debug.jar'. Stop.
make: Leaving directory `/home/build/WORK_DIR'
Can anyone explain me what should i do? Should i build the whole android project first, or is it a bug in makefile?

Try building the entire source at first...After that whenever you make changes in the source code of any application(in your case Phone), you need to rebuild the entire code. The rebuild process will not take time as only the changes will be built into the system image..Use "make" instead of "mmm" . However don't use "make clean" as it will erase your earlier build and start from scratch. So the outline is:
Execute "make" for building the first time
Make your changes in the application
Execute "make" once again

Use "make snod" if you just want only one component that is built to be attached to the system.img

Related

Android gradlew.bat assembleRelease choose starting package

I have an Android Studio App that now has close to 100 "productFlavors" associated with it, of course all defined in the build.gradle. I would like to build them from command line since building them one at a time in the IDE would be a nightmare. My issue arises when I run into an error in the middle of building them using the command line gradlew.bat assembleRelease. Once I fix the error I would like to start building at the point of failure (maybe 50 flavors into the build) rather than at the beginning. Is there a way to do that with Gradle? With Ant I was forced to comment them out, I am hoping there is a better way with Gradle since the structure is much more complicated in the file.
UPDATE
I finally went with a solution that encompassed Gradle and Ant (yucky but it works). Basically I wanted to build on of my 100 White Label flavors, with a prefix of the version, and then copy it to the deliver APK without the version. To do this my ANT script looks like:
#!/bin/sh
DEPLOY_DIR=C:/AndroidBuilds/MyCompany.Build
VERSION="63"
NAME="WhiteLabel1"
DEPLOY_FOLDER="whitelabel1"
APK_NAME=$NAME$".apk"
gradlew assemble$NAME
cp $DEPLOY_DIR/$DEPLOY_FOLDER/$VERSION"-"$APK_NAME $DEPLOY_DIR/$DEPLOY_FOLDER/$APK_NAME
NAME="WhiteLabel2"
DEPLOY_FOLDER="whitelabel2"
APK_NAME=$NAME$".apk"
gradlew assemble$NAME
cp $DEPLOY_DIR/$DEPLOY_FOLDER/$VERSION"-"$APK_NAME $DEPLOY_DIR/$DEPLOY_FOLDER/$APK_NAME
This results in 2 APKs being generated, 63-WhiteLabel1.APK and 63-WhiteLabel2.APK, which are then copied to their respective deploy directories as WhiteLabel1.APK and WhiteLabel2.APK
I suppose if you are clever you could make this take parameters to run just the one you want, but Android Studio does a pretty decent job of that.
You can't specifically do that, but you can work around the issue and fix it with some script-magic.
If you have a build type called Release, and a flavor called Iron, you could run:
gradlew.bat assembleIronRelease
So you could write a script that would run through a loop of all flavors, and if it fails, it would tell you which one failed. You can then fix the error, and start the script again, telling it to start at X flavor (you would have to write the logic to tell it where to start though).

Android ndk-build error make.exe: *** create_child_process: DuplicateHandle(In) failed (e=6)

I'm relatively new to Android and I have a problem using the ndk-build command.
I use the NDK r9d under Windows 7 64bits.
When I run my build system which creates my Android project (makefiles etc...) and then creates a process running ndk-build.cmd (I checked that it is call in the Android project) I get the error:
make.exe: *** create_child_process: DuplicateHandle(In) failed (e=6)
But when I run ndk-build.cmd "manually" in the windows command console in the same Android project created by my build system (or any Android project) everything is working.
I did find some related questions like here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014825836
https://cygwin.com/ml/cygwin/2004-09/msg01506.html
But all I found says either that it's a problem of make version which is not (I think) since ndk-build works fine when I use it "manually" or it says that it is related to stdin handling and again I don't think that the issue here. Plus all the anwsers that I found was related to a similar error but not exactly the same:
process_easy: DuplicateHandle(In) failed (e=6)
Maybe someone knows the meaning of my error message. I don't think that's specific to Android ndk-build but maybe.
Thank you for reading (and sorry for any english mistakes, I am french and not fluent in english)
Finaly, I found a solution to my problem here:
http://www.zeusedit.com/zforum/viewtopic.php?t=174
I am not sure about what the problem was but according to this link, it was related to the make environment and the handles.
The solution : Instead of using the createProcess function (from Windows) directly to call ndk-build.cmd, I created a batch file containing:
start ndk-build.cmd
And I called this batch (.bat) via the createProcess function.
I let you see the link for more details.

NDK prebuilt shared library file format not recognized

I've been trying to follow this sample on github to get a basic spotify implementation working, I've followed the setup steps, installed all the required libraries etc but keep getting the following error during the native build stage.
**** Build of configuration Default for project LoginActivity ****
c:\Android-ndk\android-ndk-r8e\ndk-build.cmd NDK_NO_WARNINGS=1 all
Install : libspotify.so => libs/armeabi/libspotify.so
c:/Android-ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/arm-linux-androideabi-strip:./libs/armeabi/libspotify.so: File format not recognized
make: *** [libs/armeabi/libspotify.so] Error 1
make: *** Deleting file `libs/armeabi/libspotify.so'
**** Build Finished ****
I downloaded the android specific library, then tried various combinations of Linux ARM libraries just to see what would happen and the result is always the same. When removing libspotify.so from the directory the build fails as expected because the file can't be found so I know the script is trying to process the file.
As far as I can tell I've followed the setup to the letter, my current guess is that the problem is related to running a 64 bit version of eclipse/java etc. Can anyone shed any light on this issue?
You need to find out what is the compilable target of this file. If you use linux, run the following command:
$ file libspotify.so
You will see if it can compile with armeabi or x86. Then, in application.mk, you need to set up the APP_ABI to armeabi or APP_ABI:X86.
It turns out this issue was caused by a corrupt archive with the .so file.
When I re-downloaded it, it worked fine. Thanks for the assistance.
EDIT
I found a version of the libspotify.so file which had been extracted properly here.
I believe you may have accidentally extracted libspotify.so (21 bytes), which is only a Unix symlink to the shared library libspotify.so.12.1.51 (1,961,644 bytes).
At least that's what I had just done which led me here. The latter needs to be renamed to the lookup name (libspotify.so) and then NDK makes fine.
Hope this helps another tired soul, at least. :)

Run e.g. calc.exe before build in IntelliJ with Android projects

I am trying to do some "stuff" before a build of my Android project.
The setup is roughly the following:
LibraryProject
AppA
AppB
I have run configurations for AppA + AppB
I know how to e.g. use the little checkmarks to e.g.
Deploy or not deploy
Run or not run
The one I am stuck with is Run Ant target.
What I want (the reason for this question) is telling my current running application (most of the time it is AppA when I press "run", because I changed something in the code, to e.g. persist settings.
I have complete control over the app, and already wrote several scripts to e.g. talk via ADB to the device, or even talk to the current running app using UDP and a C# host application on my development machine. So if I am able to run a e.g. shutdown.exe (.NET written by me) I can tell my app to shutdown.
So to keep it "easy" I tried to get calc.exe to start when pressing "run" inside an Android project in Intellij. But I managed to get totally lost in the build.xml configuration IntelliJ uses for Android.
I tried:
adding an exec task to the build.xml
tell him to Run Ant targets
Adding some tests
They all have no effect. I can view the Ant Build in Intellij and start the task manually, still no effect (so I cant really know if they are started by the run configuration, because the may fail silently).
I added:
<target name="-pre-build">
<exec executable="calc.exe"/>
<echo message="HelloWorld"/>
</target>
<target name="-pre-compile">
<exec executable="calc.exe"/>
<echo message="HelloWorld"/>
</target>
Any tips what I am doing wrong? Oh, one more info. If I press the green button in the Ant Build toolbar on the highest level, android tells me something about "outdated build file", but I think this is ok. Seems like he tries to run the whole Ant file then, which imports some android tasks before - but this is not what I want anyway.
So can anyone provide me an example (to start calc.exe). I will figure the rest out and update the post if neccessary for others to help.
Chris
IDEA doesn't use any Ant build by default, what you see is probably the automatically generated build.xml for this project.
You can create a new build.xml file with just the following inside:
<project name="build" default="pre-build">
<target name="pre-build">
<exec executable="c:/windows/system32/calc.exe"/>
<echo message="HelloWorld"/>
</target>
</project>
In the Android Run/Debug configuration Before Launch section specify this Ant target to be run:
I've verified it with a small sample project and calc.exe gets properly executed before I run the Android configuration in IntelliJ IDEA.
I came across this question when I was searching the same question in Google. Maybe it's quite late to post my answer, but better than none.
I found that you don't need a ant build script, that is just use the IntelliJ default system is just fine. For example, I am doing my project with android-ndk, so I want intelliJ run ndk-build NDK_DEBUG=1 -j4 before normal build.
Here is the solution:
Run -> Editor configuration
Select on of you build configuration in the left side of the dialog.
On the right side there is an area marked as Before Launch
Click the "plus" button, choose Run External Tool in the popup menu.
Click the "plus" button in the new popup window
Then you get into the real configuration window.
Sad thing is that I can't post image right now. You must want to see then on my blog

Why does Python fail to run ant build?

If I run ant release in the shell in my dir proj it works fine, however, when I try to execute it from python, it fails, why?
/Users/hunterp/proj
Buildfile: /Users/hunterp/proj/build.xml
BUILD FAILED
/Users/hunterp/proj/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project'
It is difficult to answer this question without more information about your setup or the code you are using. Particularly the parts that are generating the error since we don't know what your code looks like (either in build.xml or in your python script).
An easy thing to start with, as indicated by #Mark, is to <echo>${basedir}</echo> in your release task to see where exactly it thinks it is running from. My guess is that you are trying to load a properties file or some such and it isn't finding it in an earlier step.
What you can do if the location of ${basedir} looks different when run from within the directory versus within your python script is use a reference to where your build.xml file lives and reference from there:
<dirname property="project.basedir" file="${ant.file.project_name}"/>
Then use use ${project.basedir} instead of ${basedir}.
All of this assuming, of course, that your ${basedir} appears differently between the two. Otherwise I'd need to know more in order to diagnose the issue.

Categories

Resources