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.

Upgrading from 5.1.0 to 5.1.1 results in `Unsupported Modules Detected` gradle sync fail in Android Studio

See original GitHub issue

The app builds on the CLI (./gradlew assembleRelease, react-native run-android etc). Builds in Android Studio at least sometimes (I think I’ve had at least one instance when it won’t build in this state due to Argument for @NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null). Presents the following message:

Unsupported Modules Detected: Compilation is not supported for following modules: react-native-device-info, react-native-locale, react-native-fast-image, lottie-react-native, react-native-google-analytics-bridge, react-native-keep-awake, react-native-fetch-blob, react-native-vector-icons, react-native-sentry, react-native-orientation, react-native-sound. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

Android Studio 3.2.1

Have done:

  1. invalidate caches/restart
  2. removed node_modules, yarn.lock and global yarn cache
  3. deleted Android Studio project files

Reverting to 5.1.0 fixes it.

app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

project.ext.sentryCli = [
        logLevel: "debug"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.bighealth.REDACTED"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        debug {
            minifyEnabled false
        }
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a": 1, "x86": 2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    productFlavors {
    }
}


dependencies {
    implementation project(':react-native-sentry')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-svg')
    implementation project(':react-native-sound')
    implementation project(':react-native-orientation')
    implementation project(':react-native-locale')
    implementation project(':react-native-keep-awake')
    implementation project(':react-native-google-analytics-bridge')
    implementation project(':react-native-fetch-blob')
    implementation project(':react-native-device-info')
    implementation project(':lottie-react-native')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.facebook.react:react-native:+' // From node_modules
    implementation 'com.yqritc:android-scalablevideoview:1.0.4'
    implementation project(':react-native-fast-image')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}


apply plugin: 'com.android.application'
apply plugin: 'io.sentry.android.gradle'

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'io.sentry:sentry-android-gradle-plugin:1.7.5'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

2reactions
JofBigHealthcommented, Dec 12, 2018

For anyone else who is reading this, RN doesn’t support Android Studio 3.2.x currently (0.57.7 - see release notes for 0.57.x) due to changes with Gradle. So try 3.1.x first.

0reactions
AugustoAleGoncommented, Feb 21, 2019

@jeongsd Honestly, you have to enter in the developer.android website and you have to search the version that you want. In my case I have installed 3.1.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error running android: Gradle project sync failed. Please fix ...
Load your project in Android Studio and go to File->Settings->Gradle. Click on Use local Gradle distribution and point it to the folder where...
Read more >
Upgrading from 5.1.0 to 5.1.1 results in `Unsupported Modules ...
Upgrading from 5.1.0 to 5.1.1 results in `Unsupported Modules Detected` gradle sync fail in Android Studio ... The app builds on the CLI...
Read more >
Fix "Error running android: Gradle project sync failed. Please ...
Step 1. Firstly, we have to open Android Studio and go to the File > Press Invalidate Caches/Restart. · Step 2. Then wait...
Read more >
Release Notes - Flyway by Redgate • Database Migrations ...
Add configuration to allow flyway to fail when sqlfluff finds issues when running ... change and drift reports now fail for incompatible database...
Read more >
Android Platform Guide - Apache Cordova
In Android Studio 3.6 or later, the obsolete Android SDK Tools will need to be intalled. To do this: Open the Android Studio;...
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