React-native: API version 22 - Android

Created on 22 Oct 2015  路  7Comments  路  Source: facebook/react-native

To clarify is it possible to build React Native apps using API versions less than 23?

I need to build an app for android 5.1.1 - API version 22

I couldn't find anything in the docs, so this made me believe that it might not be possible.

Locked

Most helpful comment

Any reason for this error then:

/Users/josh/Code/rn-test/AwesomeProject/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
/Users/josh/Code/rn-test/AwesomeProject/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.258 secs
Could not install the app on the device, see the error above.

My build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.awesomeproject"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:0.12.+'
}

All 7 comments

Yep, the readme says "Supported operating systems are >= Android 4.1 (API 16) and >= iOS 7.0."

Any reason for this error then:

/Users/josh/Code/rn-test/AwesomeProject/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
/Users/josh/Code/rn-test/AwesomeProject/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.258 secs
Could not install the app on the device, see the error above.

My build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.awesomeproject"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:0.12.+'
}

Please install the SDK version 23 and use that as compileSdkVersion. Min API is 16, this is the lowest API needed for the apps to run.
See
https://facebook.github.io/react-native/docs/android-setup.html
https://github.com/facebook/react-native/blob/master/local-cli/generator-android/templates/src/app/build.gradle

Also, can you please use Stack Overflow to ask questions? Tag your questions 'react-native'. Many people from the community hang out there and questions like this have a higher chance of being answered there.

It also helps us keep track of actual bugs on github.

Is there a way to disable:

  • android:TextAppearance.Material.Widget.Button.Inverse
  • android:Widget.Material.Button.Colored

So that it would compile for API 22 (5.1.1) ?

@joshhornby have you found a solution ?

My understanding is you need version 23 compile sdk version, but the target sdk version dictates what version it runs on.

For example I have got this running on a device with version 5.1.1.

Someone can correct me if I'm wrong though.

Correct -- you must have the latest SDK (23) and can target devices all the way back to API 16.

Was this page helpful?
0 / 5 - 0 ratings