How to upload a custom build configuration to Android Things with just a main.apk

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 11:06:33

问题


I'm currently working with a Raspberry Pi 3 and Android Things (with the official RPi touch screen), and I'm trying to understand the process of flashing a custom build. I have already gone through the process of creating a starter build, and now I'm having issues with getting my main.apk booting up when I flash the image. I have already viewed this question and it doesn't seem to illuminate why mine isn't working.

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

The 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);
}
}

The Layout:

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

It's really a simple app. And it works over ADB, but does not boot when built into a bundle (Android Studio -> Build APK -> 7Zip -> Store into ZIP -> Send to Console -> Flash Build). Any advice? Are there naming conventions that I'm missing (as in do file names need to be specific)? Thanks!


回答1:


I don't know why it didn't work, but creating a new Things-based project worked. Thanks all.



来源:https://stackoverflow.com/questions/48409661/how-to-upload-a-custom-build-configuration-to-android-things-with-just-a-main-ap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!