question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build issues caused by outdated compileSdkVersion on Android

See original GitHub issue

Description

The build.gradle files in the Android templates, sample apps and the ReactAndroid library seem to all use compileSdkVersion 23, which is quite an old version and causes build issues with the latest versions of the Android Support Library: https://github.com/tinycreative/react-native-intercom/pull/75, https://github.com/intercom/intercom-android/issues/316

compileSdkVersion should generally be set to the latest available stable version, using old versions can cause build issues with newer library versions.

Reproduction

I’ve added a sample project here: https://github.com/ronocod/react-native-android-compile The 1st commit to the repo was the code as generated by RN, the 2nd commit breaks the build by updating to Support Library 25.1.1.

Solution

  • compileSdkVersion fields in the build.gradle files for the Android templates, sample apps and the ReactAndroid library need to be updated to 25.
    • Preferably targetSdkVersion, buildToolsVersion and the Support Library versions would be updated to the latest versions too.
    • I don’t have much experience with Buck, but it looks like some of the Buck config files will need to be updated too.
  • Documentation and CI setup scripts will need to be updated too as SDK version 25 will be needed, not 23.

I have a PR started here, it probably needs more work though: https://github.com/facebook/react-native/pull/12930

As far as I can see, existing React Native apps will have to be updated manually.

Additional Information

  • React Native version: February 2017
  • Platform: Android
  • Operating System: All
  • Dev tools: Android SDK 25, Build Tools 25.0.2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:23
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
afilpcommented, May 31, 2017

This issue causes problems to several packages that need version 25 (Intercom-Android being one of them). Can you consider this for change? Thanks!

0reactions
giacomocerquonecommented, Oct 4, 2017

#16178 I have problem with the version of the sdk and the build tools. Upgrading both of them to the 25 version it works. Can be merged the PR responsible for the upgrade of that stuff please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : cause android.compileSdkVersion is missing
Error : Cause: android.compileSdkVersion is missing! Guys what could be reason for this, I already have same compileSDKVersion and build tool installed. I...
Read more >
CompileSdkVersion and targetSdkVersion — what is the ...
In this article, we'll take a closer look at two values that are set in the build.gradle file: compileSdkVersion and targetSdkVersion.
Read more >
Gradle Plugin User Guide - Android Studio Project Site
This is done with the compileSdkVersion and buildtoolsVersion properties. The compilation target is the same as the target property in the project.properties ...
Read more >
Android Platform Guide - Apache Cordova
In Android Studio 3.6 or later, you need to manually add the old version of the Android SDK Tools. To do this: Open...
Read more >
Build for Android 12 with Unity | ARCore
This is caused by an incompatibility between Android Build Tools version 31.0.0 and the Unity build system. As of Android Build Tools ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found