- 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.
推薦閱讀
- Visual C++程序設(shè)計(jì)教程
- Learning Chef
- Boost C++ Application Development Cookbook(Second Edition)
- Cocos2d-x游戲開(kāi)發(fā):手把手教你Lua語(yǔ)言的編程方法
- PostgreSQL技術(shù)內(nèi)幕:事務(wù)處理深度探索
- Git高手之路
- Building Minecraft Server Modifications
- Python數(shù)據(jù)分析從0到1
- Spring Boot企業(yè)級(jí)項(xiàng)目開(kāi)發(fā)實(shí)戰(zhàn)
- AppInventor實(shí)踐教程:Android智能應(yīng)用開(kāi)發(fā)前傳
- Nginx實(shí)戰(zhàn):基于Lua語(yǔ)言的配置、開(kāi)發(fā)與架構(gòu)詳解
- Unity 2D Game Development Cookbook
- Clojure for Machine Learning
- Natural Language Processing with Python Quick Start Guide
- INSTANT JQuery Flot Visual Data Analysis