首页 文章

如何使用main.apk将自定义构建配置上传到Android Things

提问于
浏览
1

我目前正在使用 Raspberry Pi 3Android Things (使用官方的RPi触摸屏),而我在启动图像时遇到启动 main.apk 问题的问题 . 我已经看过这个question并且它没有工作 .

AndroidManifest:

<?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>

HomeActivity:

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 - >构建APK - > 7Zip - >存储到ZIP - >发送到控制台 - > Flash Build) . 任何建议?是否存在我缺少的命名约定(因为文件名需要具体)?谢谢!

1 回答

  • 0

    我不知道为什么它不起作用,但创建一个新的基于事物的项目工作 . 谢谢大家 .

相关问题