1

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!

Avag Sargsyan
  • 2,437
  • 3
  • 28
  • 41
krisds
  • 11
  • 3
  • Do you see your package when you run `adb shell pm list packages`? – Nick Felker Jan 24 '18 at 01:09
  • Yes, I do. It is listed. – krisds Jan 24 '18 at 18:28
  • Although when I try to start the app via adb, using `adb shell am start [package].HomeActivity` I get a `Error: Activity not started, unable to resolve Intent { act=android.intent.action.MAIN cat =[android.intent.category.LAUNCHER] flg=0x10000000 pkg=[package].HomeActivity}` . Any guesses here? – krisds Jan 24 '18 at 18:36
  • Typically the format is `am start com.example.app/.MainActivity` – Nick Felker Jan 24 '18 at 20:52
  • Thank you. This is odd; it argues that the activity class does not exist. – krisds Jan 24 '18 at 21:17
  • I agree that's pretty odd. Can you do something similar with one of the sample apps and see if works in that case? – Nick Felker Jan 24 '18 at 21:53
  • The Sample SimpleUI works perfectly. I'll dig into this and figure out what went wrong. Thank you. – krisds Jan 25 '18 at 01:13

1 Answers1

0

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

krisds
  • 11
  • 3