How to deal with some problems in the process of upgrading AndroidThings 0.7 to 0.8 and 1.0 official version

The project I am doing now is Raspberry Pi + Androidtings, which mainly implements data transmission and some industrial-level daily responses and file processing. A few days ago, I upgraded Android things 0.7.0 to 0.8, and today I upgraded 0.7 and 0.8 to 1.0. There are a lot of questions, mainly including the following:

1. Modify the intent filter

        When looking at the API of Androidthings before the upgrade, I found that the configuration file (AndroidManifest.xml) needs to be modified after the upgrade. The first point is to modify the path configuration of the home page, and change the " IOT_LAUNCHER" in the original main path " intent filter" to "android.intent.category.HOME", because " IOT_LAUNCHER " will be deprecated after 0.8.0, and the API says that this is beneficial to not exit the Android software after starting the hardware, and return to the main interface

<!-- 启动时自启动android Things的主程序 -->
<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.HOME" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

2. Running and debugging error: java.lang.SecurityException: Caller lacks required permission com.google.android.things.permission.USE_PERIPHERAL_IO (running environment Androidstudio3.0)

        This error is more difficult than the first problem, because in 0.7.0, IO control does not need to declare permissions, but after upgrading 0.8.0, and in versions after Androidthings, Android software needs to declare control when controlling PIO permissions. Those who have seen the API may know this, this permission declaration requires three steps:

        1. Add a paragraph to AndroidManifest.xml:

<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO" />

        used to declare permissions

        2. If you have not run the software on the Raspberry Pi or hardware before, then execute the following commands directly from the command line:

    adb install -g app-release.apk

    That is to install software for the hardware, where "-g" declares the permission to run, and the following "app-release.apk" is the apk installation package you generated (build) before running this command, because I used It is Androidstudio3.0, so the generated installation package is under "\app\release", you only need to copy the installation package to the adb folder, execute the command, and the execution result must be "success", if the following As a result, it fails


    If you have run software on a Raspberry Pi or hardware before, run the following commands:

adb uninstall [ software URL in AndroidManifest.xml (the value of package in the manifest tag)] ---- uninstall software

The next method is the same as the method above without installing the software

        3. Run in the development environment. If the above two steps are OK, then the operation is normal.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325984487&siteId=291194637