Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Windows develops the Android environment configuration


May 21, 2021 CrossApp


Table of contents


1. The following tools are required for the environment configuration of porting android:

ADT (eclipse+androidSDK)

http://pan.baidu.com/s/1dDnvbjj


androidNDK (recommended android-ndk-r9c)

http://pan.baidu.com/s/1o6KmBmq


JDK (jdk-7u45-windows-x64)

http://pan.baidu.com/s/1sj8BgNr


The tools listed above can also be used in other versions, NDK requirements r8 or more versions, the configuration method is basically the same, according to the operating system model to choose the configuration environment required kit.


2. Install the java environment

Configuring an Android environment requires the java environment to be installed first, and there are no special requirements for the installation process.

After the installation is complete, you need to configure the environment variable, create a new variable named JAVA_HOME in the Windows system variable, and the variable value is jdk's installation directory. F or example: C:Program FilesJavajdk1.7.0_45.

Create a new variable named CLASSPATH with a value of : . . % JAVA_HOME%lib; % JAVA_HOME% libtools .jar (front.; B e sure to add), find the Path variable in the system variable, click Edit, add a sign at the front of the variable value, and then add %JAVA_HOME%bin before the sign; Java JAVA_HOME% jrebin, the java's environment variables are configured, open dos, enter java, javac, java-version and other commands to see the relevant information.


3. Transplant Android

Import the project into eclipse, File-gt; New-gt; Other-gt; Android Project From Existing Code, click Browse to find proj.android in CrossApp in our engine catalog.

Pictured:

Windows develops the Android environment configuration


Import the project into eclipse, File-gt; New-gt; Other-gt; Android Project from Existing Code and click Browse to find proj.android in our newly created engineering catalog.

Pictured:

Windows develops the Android environment configuration


4. The following configuration needs to be confirmed after the import is complete:

1) Make sure the Android version is the same as the engine version

Windows develops the Android environment configuration

The Android version in the figure is 4.4.2, if you don't have the right-click engine to select the same version of Android as the new project version.

2) Change the ndk path of the new project to the root of the ndk. Example: D: androidandorid-ndk-r9

Windows develops the Android environment configuration

Example: D: androidandroid-ndk-r9c


3) Find the file file in the jni directory in the Android.mk project and find the following code:

#$(call import-add-path, $(LOCAL_PATH)/../../../..)
#$(call import-add-path, $(LOCAL_PATH)/../../../../CrossApp/the_third_party/)

Windows develops the Android environment configuration When you find it, delete the sign before the code.


5. After the above steps are complete, we directly right-click the project - run As Android Application and start compiling our project.


6. After the project imports eclipse, the exceptions and errors that occur during the compilation run and the corresponding work-outs are shown in the following table.

Error
Solutions
Package error under engineering src, prompt can not find org. CrossApp.lib this package Import the project into eclipse, File-gt; New-gt; Other-gt; Android Project from Existing Code, click Browse to find proj.android in CrossApp in our engine catalog.
Running works appear Error: Program "bash" is not found in PATH Right-click Engineering- and Properties, click on C/C?Build in the open panel, and in Build command, replace the default command with your own ndk-build.cmd in the ndk directory, e.g. D:android-ndk-r9cndk-build.cmd.
The running project appears on the Cannot find module with tag 'CrossApp' in import path

Find $(call import-module, CrossApp) in android.mk under the jni folder in your new project, adding the following two pieces of code before this sentence:

$(call import-add-path, $(LOCAL_PATH)/.. / .. / .. /..)

$(call import-add-path, $(LOCAL_PATH)/.. / .. / .. / .. /CrossApp/the_third_party/)

The path is modified to its own corresponding path.

The emulator is running a crash The android simulator only supports OpenGL ES2.0 from sdk 4.0.3, and the new simulator sdk also requires 4.0.3 and above (it is recommended that the real machine see the effect of the operation).


7. Environment configuration reference video