Search code examples
androidandroid-things

Rainbow hat android things minsdk=24 error


Im creating a test application with blinking led on Raspberry pi 3 B with the use of android things and rainbow hat by pimoroni but when i tried it, it says

Manifest merger failed : uses-sdk:minSdkVersion 24 cannot be smaller than version 27 declared in library [com.google.android.things.contrib:driver-rainbowhat:1.0] C:\Users\LENOVO-PC\.gradle\caches\transforms-1\files-1.1\driver-rainbowhat-1.0.aar\d5f46e61011d32f9fa318c0bb291f09a\AndroidManifest.xml as the library might be using APIs not available in 24
    Suggestion: use a compatible library with a minSdk of at most 24,
        or increase this project's minSdk version to at least 27,
        or use tools:overrideLibrary="com.google.android.things.contrib.driver.rainbowhat" to force usage (may lead to runtime failures)

my app gradle is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.lenovo_pc.anythingtesting"
        minSdkVersion 24
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar', '*.so'], dir: 'libs')
    //   implementation 'com.google.android.things.contrib:driver-apa102:0.3'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.android.things.contrib:driver-rainbowhat:1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
       compileOnly 'com.google.android.things:androidthings:1.0'

}

apply plugin: 'com.google.gms.google-services'

and my androidmanifest.xml is

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.lenovo_pc.anythingtesting">

    <uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!--   <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.READ_PHONE_STATE" />  -->



      <application

          android:extractNativeLibs="false"


          android:label="@string/app_name">
          <uses-library android:required="false" android:name="com.google.android.things"/>
          <!--               android:required="false"
                        tools:replace="android:required"  -->


                    <activity android:name=".innovatrics.MainActivity">
                        <meta-data android:name="android.app.lib_name" android:value="blink" />
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN" />
                            <category android:name="android.intent.category.LAUNCHER" />
                        </intent-filter>
                        <!--
                                    <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>


            </manifest>

Im running the application in Raspberry pi 3 B and I've watched different tutorials that minsdkversion is okay with 24. So im not sure what's wrong with my code


Solution

  • You are looking at an outdated tutorial. The minSdk was raised from 24 to 26 on november 29 2017 and from 26 to 27 on march 22 2018.

    You must use minSdk 27+ now.