Building wpa_supplicant with 'mm' command - android

I am new to Android. I have the entire source code of Android for the imx platform. I would like to build the wpa_supplicant folder present under external folder. Everytime I make a change, instead of building the entire source, I would like to build only the wpa_supplicant folder. I have read that using the 'mm' command I can do it. However, i am not sure where to find the 'mm' command. For when I type #mm external/wpa_supplicant_8, I get the following error message displayed:
The program 'mm' can be found in the following packages:
* mountmanager
* multimail
Try: apt-get install
I am not sure if I need to do an apt-get install or the binary is present somewhere I else. Can someone help me with this? Also, how do I compile only a single application present in external folder? Please help.

Run the build/envsetup.sh script from your root folder:
path/to/android# . ./build/envsetup.sh
Then lunch for your device, and you'll be able to mm as necessary.

Go to Android directory and run $:source ./build/envsetup.sh
'android$:lunch` and select the configuration which you are building.
Now go to the directory where project located and execute mm or 'mma' (to build the dependencies also)

Related

Trying to build Android app but got clang error

I'm new to Android development. So want to start and just build and run Hello World app in my mobile. I've installed NDK, clang-12, Fyne and run
fyne package --os android --appID com.example.myapp
Got
go build -buildmode=c-shared -o /tmp/gomobile-work-791801243/lib/armeabi-v7a/libparts.so parts failed: exit status 2
# runtime/cgo
clang: error: no input files
The project's structure:
parts:
- go.mod
- Icon.png
- main.go
If I run manually from project root (parts)
go build -buildmode=c-shared -o /tmp/gomobile-work-791801243/lib/armeabi-v7a/libparts.so parts
It creates .so file without any error. Seems like it's just about relative path, but how can I fix it? Sorry for providing poor info, really don't know what may be useful. So please write in comments what info do you need and I'll provide it.
Are you running the command from inside the “parts” folder?
Perhaps you have GOOS or GOARCH set which could alter the build path?
You might have a broken development environment when trying to build for Android. Short of reinstalling it, I would recommend using fyne-cross with either docker or podman.
Just install fyne-cross with:
go install github.com/fyne-io/fyne-cross#latest
Followed in your application directory by:
fyne-cross android

project_create.sh: line 4: android: command not found (cygwin&android&jni)

http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Windows.pdf
This is the tutorial I am following and I stucked in the JNI to opencv library
according to the steps I had run project_create.sh in cugwin and come up with the result project_create.sh: line 4: android: command not found
Then I created a project_create.bat file with line android update project --name android-opencv --path .\ copy project.properties default.properties
BUT it also come up with android is not recognized as an internal or external command/ operable program or batch file.
Both .sh and .bat didn't work and I couldn't move on. Because ant step depend on it
Could someone give me any idea how to fix it??
Thank you!
Android is an executable located in <path-to-your-SDK>/tools/. Unless your working directory is tools, or you have added it to your PATH, you will get this error.
To fix it, either edit the script to use the full path, or copy paste the files into the tools directory and run them.
Okay finally I made it!
First of all, modified project_create.sh put the path to android like C:/cygwin/home/Joyce/SDK/tools/android update project --name android-opencv --target 2 \ --path
And better add up the target too because you don't have to deal with the "target not found" problem.
Second of all, don't run it in cygwin terminal, run "sh ./project_create.sh" in windows terminal.
Thirdly, make sure ant\bin had been added up to PATH, then can run "ant debug" in windows terminal.
Finally, got "BUILD SUCCESSFUL"! JNI to opencv library done!

Emma does not generate coverage.ec

I setup Emma and it used to work for me. Then we had source code changes and now it doesn't generate coverage.ec at all. It does generate coverage.em.
Near the end of testing, it has error messages:
[exec] INSTRUMENTATION_CODE: 0
[echo] Downloading coverage file into project directory...
[exec] remote object '/sdcard/coverage.ec' does not exist
BUILD FAILED
/var/lib/jenkins/android-sdk-linux_x86/tools/ant/build.xml:1056: exec returned: 1.
Line 1056 of build.xml is
"{adb}" failonerror="true".
I see that I do have coverage.em on the desktop, which means my code are instrumented.
the command I use under the \test is
ant emma debug install test
This worked for me before. Running code coverage always crashes for me, usually near the end of the unit test, but it'd always get me some coverage. Now it crashes out and doesn't produce coverage.em.
I also tried to access /sdcard/ and it's perfectly accessible and writable.
This has blocked me for days, any input would be much appreciated. I am also new to all this Android, Ant and Emma, so thanks!!
Update:
I just cleaned up the environment and ran the command again.Now coverage.em is no longer generated either. Which tells me the source code are not instrumented. But the command I used above should instrument project, its test project, install and start test. I didn't change emma def in build.xml except to change the coverage.ec location to /sdcard/coverage.ec. This is because by default it goes to /data/data, and I don't have permission to access data/data on this phone
I am using r15 of Android SDK, and the default build.xml. I only changed the path to coverage.ec to /sdcard/coverage.ec. To run instrumentation
Go to main_project
$andriod update project -p .
Go to main_prject\test
$android update project -m ../ -p .
To start code code
$ant emma debug install test
It generated main_project-instrumented.apk and test_project-debug.apk. Both are installed and I can see it executes testing.
You have to make a test project with the android command line tools first.
Create Project & Test Project
Assuming your project is stored in D:\AndroidProject and your programming against android API level 8. First you use this command to create the project:
android update project --path ./ --name blabla~ --target android-8 --subprojects
Then create an folder for the test project and navigate into that folder:
mkdir Android_test
cd Android_test
Then create the android test project with the below command
android create test-project --main ../AndroidProject --path ./
Ant building with emma coverage report (with root)
Execute this command (from jenkins select and build step) to get a build done with emma reporting:
ant emma debug install test
Caution : For this to work you have to connect rooted device or emulator, then execute ant command!
Change Build xml file (so no root is required)
If you don't want to root your device an alternative solution is to alter the location of these coverage reports. For this you should modify the build.xml file.
(you should googling about that for more information, briefly explained here)
Open the build.xml -> find the location where the coverage.ec file is stored. In most cases this will be stored in /data/data/com.example.Android/coverage.ec
The problem here is that the /data/data/~~~ path is protected (hence the required root).
anyway~ you can get a coverage.html file in your test project folder/bin. The next steps explain how to change this to save this file on the /sdcardinstead!
You can open your build.xml file and at the last line ~ you can find the command import ~~~ build.xml which means that your build.xml file will import anoother build.xml file.
The other build.xml file is part of the android SDK and is located at ${Android-sdk}/tools/ant/build.xml.
Required changes for build.xml file
We can't change this file (without getting into trouble) so instead copy the complete file to an alternative location or directly into your projects build.xml file.
Don't forget to adapt or change the import statement in your build.xml file whatever you choose to do.
This is what you need to change in that new build.xml file:
Erase the import= ~~build.xml
Erase the first line which is xml=ejkwjkw?e jw ""project = "android_rule" ~~ ~blabla)
and last line /project
update address to /sdcard/coverage.ec
Then, you can get coverage.ec file~
I ran into this issue after updating my SDK to r16: Emma code coverage not working in r15 of tools
and this fixed it for me:
ant all clean emma debug install test
But I am unsure if you have the same problem.
I don't have permission to access data/data on this phone
Is it a non-rooted device? Note that the build says:
WARNING: Code Coverage is currently only supported on the emulator and rooted devices.
Maybe you can't work around this limitation by just changing the location of the coverage file. Does it work on a virtual device?

Android NDK: ndk-build script fails - script "check-cygwin-make.mk" not found

I'm new to development with the NDK of Android.
As I'm developing on Win7 I installed Cygwin in order to build the native binaries.
When running ndk-build from the project folder /home/simon/ndk/hello-neon I get the error
ERROR: You are using a non-Cygwin compatible Make program.
Currently using: C:/Programs/cygwin/bin/make
To solve the issue, follow these steps:
1. Ensure that the Cygwin 'make' package is installed.
NOTE: You will need GNU Make 3.81 or later!
2. Define the GNUMAKE environment variable to point to it, as in:
export GNUMAKE=/usr/bin/make
3. Call 'ndk-build' again.
The problem that stops me now is that the ndk-build script seems not to be able to call the check-cygwin-make.mk script in the following lines:
GNUMAKE=`cygpath -u $GNUMAKE`
PROGDIR_MIXED=`cygpath -m $PROGDIR`
CYGWIN_GNUMAKE=`$GNUMAKE -f "$PROGDIR_MIXED/build/core/check-cygwin-make.mk" 2>&1`
When calling
echo $CYGWIN_GNUMAKE
I get the reply:
make: C:/Programs/cygwin/home/simon/build/core/check-cygwin-make.mk: No such fil
e or directory make: AndroidManifest.xml build.properties default.properties jni
res src No rule to make target `C:/Programs/cygwin/home/simon/build/core/check-
cygwin-make.mk'. Stop.
Now I'm lost because I don't understand the role of the check-cygwin-make.mk script and I could not find it anywhere on my drive.
I'm aware of the problem with spaces in the C:/Program Files/ folder name, and I think this is not problem now.
I hope someone can help my to solve this issue,
Regards,
Simon
Install android-ndk and cygwin(with "make" support command) then set the varaibles like this
Right-click My Computer, and then click Properties.
Click the Advanced tab.
Click Environment variables.
then edit"PATH" add this line
C:\cygwin\bin like this
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files......;C:\cygwin\bin
then try with your built steps
'check-cygwin-make.mk' is in '\android-ndk-r6b\build\core', and you should have installed Android NDK to a directory without spaces in the path.
Next you should be running ndk-build either from Cygwin-shell, or with the command 'bash -c ndk-build'.
And of course the necessary paths both to Cygwin binaries (as in the previous answer), and to ndk-build should be specified in PATH.

NDK build error

Hi I am new to Android NDK Development.
MacBook-Pro:JNIexample sk$ ndk-build
usage: dirname path
gmake: /Users/sk/build/core/build-local.mk: No such file or directory
gmake: *** No rule to make target `/Users/sk/build/core/build-local.mk'. Stop.
Why do I get his error?
So I was having the same trouble, and it looks like if I have any directory which is a part of full dir-path which has dir-name with space (' ') in between then 'ndk-build' wont be able to resolve paths. So my directory name "development tools" wasnt good enough so I changed it to "developmenttools" and it worked. If I hard-code the path in 'ndk-build' then it was working so found out the reason.
You need to specify the project you want to build. Like this: ndk-build -C location_of_project.
For example, to build the hello-neon sample that comes with the NDK you would go to your ndk install root and do ndk-build -C samples/hello-neon
The ndk-build tool is actually just a wrapper that calls gmake with the build-local.mk file. It finds the build-local.mk file by creating a relative path rooted at the location of the ndk-built tool. Sounds like you don't have the full NDK installed, or maybe moved the ndk-build tool without moving the rest of the NDK contents?
I also faced this problem. And i solved it and post entire answer here. I hope it helps you.
Please notice that from the error message:
gmake: /Users/sk/build/core/build-local.mk: No such file or directory.
The build/core/builid-local.mk is actually in the ndk's root directory, why is it listed as the /Users/username/build…?
I've encountered the same error on my Macbook. I've put the ndk inside /Applications/Android Studio.app directory, since there is a space between the name, somehow the tool in ndk can't resolve the implied path. That's why the error message is printed.
Later I renamed Android Studio.app to Android-Studio.app and thus resolved the issue.
The solution for me was different. If you look in the ndk-build script, you see it immediately runs `dirname $0` to get the directory to work in.
I was calling "ndk-build" from my command line, which was using a copy of the ndk-build script that I had put in /usr/local/bin/ and so my error was '/usr/local/bin/build/core/build-local.mk: No such file or directory'.
The solution is to be in the ndk folder where the real ndk-build script lives, and use the -C /path/to/project option to tell it where to start. So, 'cd /path/to/ndk' and then run './ndk-build -C /path/to/project'
I was having same problem. I created new workspace and import existing project to it. But forgot to add ndk location in windows->preferences->Android->NDK.

Categories

Resources