In this article, the use of ndk is mainly about the research and translation of some ndk compilation options (in fact, Google's documents have already been quite clear ). Even the test environment is slackware 12.0 + Android 1.5 R1 for Linux + JDK 1.6.0 _ 12, and ndk uses Android 1.5 ndk r1 (just decompress it directly, without installation ).
1. Start with ndk InstallationWhen installing ndk, you need to r
Detailed explanation of Android. mk specifications
This article from: http://blog.ednchina.com/laizibin315/1895365/message.aspx
The android. mk file is a required file for compiling C code using ndk. The Android. mk file describ
Android NDK Development (III)-Common Errors and LOG usage, androidndk
Reprinted please indicate the source:Http://blog.csdn.net/allen315410/article/details/41826511
Android NDK development often has unexpected errors due to some factors. Many times debugging these errors is more complicated than debugging Java code. On the one hand, there are many causes of errors, on the other hand, NDK development involve
tool to publish.(4) Digital certificates are valid, and Android only checks the validity of the certificate when the application is installed. If the program is already installed in the system, even if the certificate expires, it does not affect the normal function of the program12. Talk about the Android NDK understandingNDK Full Name: Native development Kit.1. The NDK is a collection of tools. * The NDK
entire source code. If it is executed in a sub-directory under the root directory of the Android source code, it will start from this sub-directory and go up to a directory until the root directory to find whether there is an Android. mk file. If so, compile the modules described in the Android.
/sample copy Android. mk, Application. mk to study. opencv/jni directory in a sample
Set the compilation script
In Android. mk, include $ (CLEAR_VARS) and add downstream
Include $ (OPENCV_PACKAGE_DIR)/$ (TARGET_ARCH_ABI)/share/opencv/OpenCV.
the product from selection, variant local variant =$ (-n $ selection |-e [$? -Ne = [-z-o-z // export TARGET_PRODECT, TARGET_BUILD_VARIANT and TARGET_BUILD_TYPE. For example, if full-eng is selected, TARGET_PRODUCT = full, TARGET_BUILD_VARIANT = eng export TARGET_PRODUCT =4. Compile -- make-j8
Make must have Makefile. The Makefile in the Android root directory simply includes a file:
include build/core/ ### DO NOT EDIT THIS FILE ###
Build/core/main
: copy and paste the file directly using the overwrite method. Also, you need to delete several files that may no longer be useful automatically generated by the system.
Step 4:Edit Android. mk and other files in the JNI folderThis step is complex and requires you to have a deep understanding of the locations and roles of application. mk and
requirements. Apart from using sharedUserId, the same signature must also be used.
3) system signature
To use system permissions, you must use the system's key to sign the apk.
4) Android. mk
Modify the Android. mk file and add the LOCAL_CERTIFICATE: = platform line. In command line mode, if you use mm to compi
only used to provide users with complex Web interfaces, using native code through JNI may reduce the performance. There are no written rules on when to use and when not to use NDK. the preceding rules only provide some general principles and issues that need attention.
Obtain NDK
Developers can obtain the latest NDK version at http://developer.android.com/sdk/ndk/index.html. In the latest version of NDK r6b, NDK can be used to build native libraries based on ARM * and x86 (Intel Atom micro-arch
directory is used to store things related to C ++ code, obj stores the middleware generated during C ++ compilation. The generated library is written to the libs folder.The following file is generated in the jni Folder:. Cpp, an Android. mk, where. Cpp is automatically generated and used to write C ++, while Android. mk
1. Set the compilation option to make-J5 target_arch = x86 target_product = generic target_simulator = false target_build_type = release target_ OS = Linux local_prelink_module = false.
2. Set line 91 in build/CORE/envsetup. mk to x86 (this step can be omitted)
3. Modify Android. mk In the build/tools/dexpreopt directory as a
used in this article has passed the Chinese version. Bill has uploaded the links Chinese package and can be downloaded by anyone who needs it. 2) When installing cygwin 1.7.x cygwin, pay attention to the download of the development kit. The default value is default. We need to select the necessary development kit and expand the devel node to select the following tool kits in sequence, click Next to complete the installation. (3) android-ndk-r8d 4) ec
. EXTRA_KEY_CONFIRM, false); // Replace "false" with "true". The intent Confirmation window is displayed. setFlags (Intent. FLAG_ACTIVITY_NEW_TASK); startActivity (intent); break; case R. id. reboot_btn1: Log. v (TAG, "broadcast-> reboot"); Intent intent2 = new Intent (Intent. ACTION_REBOOT); intent2.putExtra ("nowait", 1); intent2.putExtra ("interval", 1); intent2.putExtra ("window", 0); sendBroadcast (intent2); break;
Note the following:
First, as mentioned above, you need to escalate the APP
The Android compiling environment is complex, and unlike the normal compiling environment: Only Makefile files are available in the top-level directory, while each other component uses the unified standard Android. mk. android. the mk file itself is relatively simple, but it
/packaging/systemimage_intermediates/system. img
Install system FS image: Out/target/product/generic/system. img
Target RAM disk: Out/target/product/generic/ramdisk. img
Target userdata FS image: Out/target/product/generic/userdata. img
Installed file list: Out/target/product/generic/installed-files.txt
2. problems that may occur during compilation.
Question 1: You are attempting to build on a 32-bit system.Modify the main. mk file in the build/Core
-click Run-> Debug deployments-> Remote java application and set "Host:" to localhost and "Port:" To 8800, "Connection Type" is Standard (Socket Attach)
Then "Apply"
Note: The port set above must be the same as the port set in DDMS. The ADT plug-in uses port 8700, so the port set above is 8800. If the VM cannot be connected, note that you must select a process corresponding to an application in DDMS before executing Debug in eclipse.
During eclipse debugging, you can set breakpoints and perform
(). inflate (R. menu. activity_main, menu );Return true;}}
(2) generate the. h header file and go to the bin/classes directory of the project under the windows command line to execute the command:
Javah-classpath.-d jni com. jun. jnitest. MainActivity
The required header file is generated under the jni directory in the current directory.
(3) create the Application. mk file in the project directory.
APP_PROJECT_PATH: = $ (call my-dir)
APP_MODULES:
If you want to add a ringtone to the Android system, you can use the ADB push method. However, if you want to modify the system multiple times, it will be too difficult to push it in. Here is a simple method, it is to compile the ringtone into the Android system. in the imgfile, the ringtone is automatically added every time you brush the image.
If you don't talk much about it, You can directly get into th
Android Development (37) android uses android_serialport_api to operate the serial port to solve the permission problem. androidserialport
Recently, we have a project where we want to use the android device to operate the serial port zebra GK888T printer and print the QR code using the printer.
Hardware Device connection method:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.