Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile ReactAndroid, fbjni error

Downloaded from GitHub, to make moudle 'ReactAndroid', then:

Error:(687) Android NDK: Module reactnativejnifb depends on undefined modules: fbjni    
Error:(700) *** Android NDK: Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies)    
Error:Execution failed for task ':ReactAndroid:buildReactNdkLib'.
Process 'command '/Users/sumomokawaakira/Downloads/adt-bundle-mac-x86_64/sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2
like image 650
cdmalcl Avatar asked Mar 10 '17 14:03

cdmalcl


2 Answers

I had this problem too. I think you can fix it by making sure you are using the precisely correct version of the Android NDK (android-ndk-r10e).

Also make sure that you set the environment variables and stuff done right.

(For what it's worth I'm stuck on later steps, but hopefully this should help you get passed this particular issue)

like image 139
Deon Nicholas Avatar answered Nov 20 '22 04:11

Deon Nicholas


You have to change your path to ANDROID_NDK to run gradle command locally.

export ANDROID_NDK=/Users/your_unix_name/android-ndk/android-ndk-r10e

In my case, I put NDK file at /Users/tomo/temp/android-ndk-r10e

so export ANDROID_NDK=/Users/tomo/temp/android-ndk-r10e

Or if you do not want to change ANDROID_NDK, you can update ReactAndroid/build.gradle

def findNdkBuildFullPath() {
    // we allow to provide full path to ndk-build tool
    if (hasProperty('ndk.command')) {
        return property('ndk.command')
    }
    // or just a path to the containing directory
    if (hasProperty('ndk.dir')) {
        def ndkDir = property('ndk.dir')
        return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
    }
    // ** Add below. should be before if (System.getenv('ANDROID_NDK') clause **
    Properties properties = new Properties()
    properties.load(project.rootProject.file('ReactAndroid/local.properties').newDataInputStream())
    if (properties.hasProperty('ndk.dir')) {
        def ndkDir = properties.getProperty('ndk.dir')
        return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
    }
    if (System.getenv('ANDROID_NDK') != null) {
        def ndkDir = System.getenv('ANDROID_NDK')
        return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
    }
    def ndkDir = android.hasProperty('plugin') ? android.plugin.ndkFolder :
            plugins.getPlugin('com.android.library').hasProperty('sdkHandler') ?
                    plugins.getPlugin('com.android.library').sdkHandler.getNdkFolder() :
                    android.ndkDirectory.absolutePath
    if (ndkDir) {
        return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
    }
    return null
}

then update ReactAndroid/local.properties

ndk.dir=/Users/tomo/temp/android-ndk-r10e
sdk.dir=/Applications/sdk

and Run app from Android Studio

like image 21
tomoima525 Avatar answered Nov 20 '22 04:11

tomoima525