- Android Things Projects
- Francesco Azzola
- 225字
- 2021-07-02 20:46:25
Create the project manually
This step is longer in respect to the previous option, but it is useful to know the main differences between these two worlds:
- Create a new Android project. Do not forget to set the Minimum SDK to level API 24:

- By now, you should create a project with empty activity. Confirm and create the new project.
There are some steps you have to follow before your Android app project turns into an Android Things app project:
- Open the Gradle scripts folder and modify build.gradle (app-level) and replace the dependency directive with the following lines:
dependencies {
provided 'com.google.android.things:androidthings:
0.2-devpreview'
}
- Open the res folder and remove all the files under it except strings.xml.
- Open Manifest.xml and remove the android:theme attribute in the application tag.
- In Manifest.xml add the following line inside the application tag:
<uses-library android:name="com.google.android.things"/>
- In the layout folder, open all the layout files created automatically and remove the references to values.
- In the activity created by default (MainActivity.java) remove this line:
import android.support.v7.app.AppCompatActivity;
- Replace AppCompatActivity with Activity.
- Under the folder java remove all the folders except the one with your package name.
That's all. You have now transformed an Android app project into an Android Things app project. Compiling the code you will have no errors. In future, you can simply clone the repository holding the project template and start coding.
推薦閱讀
- AngularJS Testing Cookbook
- 數據庫系統原理及MySQL應用教程
- Securing WebLogic Server 12c
- D3.js 4.x Data Visualization(Third Edition)
- Learning Probabilistic Graphical Models in R
- Extreme C
- 智能搜索和推薦系統:原理、算法與應用
- Arduino可穿戴設備開發
- 網絡數據采集技術:Java網絡爬蟲實戰
- Learning Android Application Testing
- 零基礎學Java第2版
- Getting Started with Windows Server Security
- Java核心技術速學版(第3版)
- JavaScript高級程序設計(第4版)
- Visual C++程序開發范例寶典