我目前正在使用Raspberry Pi 3和Android Things(带有官方 RPi 触摸屏),并且我正在尝试了解刷新自定义构建的过程。我已经完成了创建入门版本的过程,现在我在main.apk
刷新映像时遇到了启动问题。我已经查看了这个问题,它似乎并没有说明为什么我的问题不起作用。
安卓清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="[...].thingstest">
<application
android:screenOrientation="landscape"
android:label="@string/app_name">
<uses-library android:name="com.google.android.things" />
<activity android:name=".HomeActivity">
<intent-filter>
<!--Launch activity as default from Android Studio-->
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!--Launch activity automatically on boot-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.IOT_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
家庭活动:
import android.app.Activity;
import android.os.Bundle;
public class HomeActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
}
}
布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[...].thingstest.HomeActivity">
<Button
android:id="@+id/button"
android:layout_width="193dp"
android:layout_height="169dp"
android:text="@string/pushme"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</android.support.constraint.ConstraintLayout>
这真的是一个简单的应用程序。它可以在 ADB 上运行,但在构建到包中时无法启动(Android Studio -> Build APK -> 7Zip -> Store into ZIP -> Send to Console -> Flash Build)。有什么建议吗?是否有我遗漏的命名约定(如文件名是否需要具体)?谢谢!