Jiyou Sharing | Import the correct posture of Gizwits Android open source project

The following article comes from Xiaoyu Programming, the author Xiaoyu tt

 

"Using the Gizwits AIoT platform to support the project to generate the APP source code, you can easily solve the Android open source project." After the developer downloads the source code, he only needs to optimize the UI and design the device control interface control logic. The source control page writes the Gizwits SDK The standard process of controlling equipment, in the secondary development process of APP source code, you only need to optimize the relevant code according to this process to quickly complete the intelligent control APP for your own products.

 

So as long as we successfully import the source code project file into Android Studio, then we can freely customize our application, so how to import it into Android Studio correctly, compile it successfully and run it on the real machine?

 

01Download the project

On the Gizwits official website, after we define the data points, download the project file in the Service -> Application Development submenu.

Introduction of Gizwits APP code automatic generation service: http://docs.gizwits.com/zh-cn/UserManual/devApp.html

02 method

Since the local environment is different from the open source project file, in theory, we can modify the environment in the open source project file to be the same as ours locally and then it can be imported smoothly.

 

In order to modify the configuration file of the open source project correctly, we can create a new local project folder for reference.

first step

Modify the build.gradle file in the root directory

 

 

Make the build.gradle in the open source project consistent with the local project.

 

Second step

Modify the gradle-wrapper.properties configuration file in the gradle/wrapper folder

Keep the gradle version in distributionUrl consistent with the local project;

third step

We then modify the build.gradle file in the app directory

 

At this time, the difference between open source projects and our local projects is a bit big, we only need to select the key points to modify

The cloud version of wit compileSdkVersion, buildToolsVersion, minSdkVersion, targetSdkVersionconsistent with local; here since the end of 2018 due to the start of Android has been abandoned compile, so here we need to compilebe replaced implementation, at the same time com.android.support:design, com.android.support:appcompatreplaced consistent with the local version 28.0.0 

The following is the revised version:

the fourth step

Import project and configure

Open Android Studio to modify the basic configuration parameters and have been modified almost, then we import the project to have a try, open the Android Studio welcome interface, click Open an existing Android Studio project;

In the engineering interface toolbar, click the compile button. At this time, some minor errors may be reported. For example, it means that the minimum development version does not need to be explained in the manifest file. We only need to click the blue underline to jump to the following interface. Click the content of the box, open the manifest file to delete and change the line, and try again to re-synchronize the gradle project.

 

the fifth step

Modify some obsolete functions

Click the small hammer to recompile the project, and the following error will still be reported at this time:

An error is reported here (the symbol variable cannot be found MAXRIX_SAVE_FLAG) This is because our SDK version is higher, and the new SDK has modified and called the method in the previous version canvas.save(Canvas.CLIP_SAVE_FLAG); the method compiler reports an error, we only need to save()delete the parameters in the method. Yes, canvas.save()it compiles by calling the method directly .

At this point, our APP is ready to run!

  end..

This tutorial uses the source code of the Gizwits AIoT platform as an example of how to compile the project correctly. In fact, most of the Android open source projects on the Internet can be imported in this way.

  I missed #Autumn's first cup of milk tea, then let's write the code together

  Today’s recommendation, arrange additional purchases of ducks..

China Mobile Cat.1 4G DTU module ML302-GC211 supports OTA free development and quick access to Gizwits

 

₳LAqWcULmxxL₳

Copy Taobao password to open Taobao

(Remember to copy the two ₳ symbols)

Guess you like

Origin blog.csdn.net/gizwits_csdn/article/details/108844677