I. Preface:

A few days ago hand Amoy finally cloud habitat congress said Atlas open source, here should cheer 👏. Official website address, GitHub address

Today, I will not talk about the original reason (I may write later). If you are interested, you can see the official document: official tutorial. In view of the many pits encountered in the initial Demo given by the official, I will summarize a little, so that the friends who are preparing to explore will not be confused to step on the pits.

⚠️ note: reprint please specify the original address, thank you!

Download Demo and import it to Android Studio

Git Clone the entire project or download it locally: github.com/alibaba/atl…

1. There are two projects under Atlas-Demo:

FistBundle: When it is a standalone component;

The APP is the actual engineering that integrates the components and ultimately packages them into the APK that we want.





Structure of the Demo

2. Import projects

Android Studio: File->New->Import Project-> Import the FirstBundle and the app Project separately. Now AS is version 2.3 and gradle has been updated to version 3.3, we will not touch the other configuration of the Project for the time being. Explore further on this basis.





Import the project

Gradle 2.14.1 gradle 2.14.1 gradle 2.14.1

http\://services.gradle.org/distributions/gradle-2.14.1-all.zipCopy the code





Configure gradle version

4. Build the FirstBundle project

Error:Cause: Gradle 2.14.1: gradle 2.14.1: gradle 2.14.1 Zip file is empty), OS can go to gradle folder: /Users/ user name /.gradle/wrapper/dists Check whether there is a good file, as follows: /Users/ user name /.gradle/wrapper/dists Check whether there is a good file, as follows: You can also download it and put it in the corresponding directory





gradle

Modify builde.gradle for FirstBundle

/Users/ user /.m2/repository/

publishing {
    publications {
        maven(MavenPublication) {
            artifact "${project.buildDir}/outputs/awb/${project.name}-release.awb"
            artifact sourcesJar
        }
    }
    repositories {
        mavenLocal()
//        maven {
//            url "url"
//            credentials {
//                username = "xxx"
//                password = "xxx"
//            }
//        }
    }
}Copy the code
After modification, shell construction is performed
 ./gradlew clean assembleRelease publishMavenPublicationToMavenLocalCopy the code

6. App Project

Modify Builde. gradle at about 37 lines. It’s strange that ali team made so much fuss with a simple Demo. Just change firstBundle to a hump FirstBundle, because the awB generated by the FirstBundle project is firstBundle.





Modify the depend on

Third, build

1. The key lies in the two SH scripts under app project





Build, update

2, modify buildapk.sh

Add adb install -r build/outputs/apk/app-debug.apk to the end of the file.

Terminal Run the sh buildapk. sh command. Apk contains app and FirstBundle projects after the command is successfully executed

sh buildApk.shCopy the code

3, sh buildTpatch. Sh

Run the sh buildtpatch. sh command to push the resource to the phone, see buildtpatch. sh. Click “Dynamically Deploy” to update package content, and you’re done: a simple demonstration of integrating components and quickly updating.





The Demo interface

Four,

Smiling face :), it took a whole day to figure out a Demo, which is a bit expensive. I hope the Atlas team can enrich the Demo while optimizing the framework. After all, we still need to start with documents and demos. It’s a waste of life for thousands of people to spend time on solving these problems. Have doubt please leave a message, thank you!