Download the android source code from the command line under Mac and build the apk process

The premise is that java, sdk, ndk, cmake, gradle, and gradlew have been installed and configured.

1. Download the source code:

git clone http://git-ma.xxxx.com.cn/xxxx/xxxxx-ANDROID.git

 

2. Change the actual project to use the small framework of android, and the framework folder is placed on the master branch. The develop branch to be compiled does not have this folder. need to download

  git submodule update --init --recursive

 

3. Enter the android project directory

  • ./gradlew cleanLib

 

  • ./gradlew buildLib

Prompt when executing this command:

 What went wrong:

A problem occurred configuring project ':lib.background'.

> java.io.FileNotFoundException: /Users/xxx/AndroidStudioProjects/xxxx-ANDROID/xxxx/local.properties (No such file or directory)

Just manually create a local.properties file in the project root directory. And specify the sdk and ndk locations in the file. The content is as follows:

ndk.dir=/Users/xxxx/Library/Android/sdk/ndk-bundle
sdk.dir=/Users/xxxx/Library/Android/sdk

 The execution result is as follows:

 

  • The execution result of ./gradlew cleanBundle is as follows

 

 

  • ./gradlew buildBundle

 

  • Execute the command to package ./gradlew :app:build

  

 

View the packaged apk

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324975238&siteId=291194637
Recommended