从GitHub下载,制作moudle'ReactAndroid',然后:
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
答案 0 :(得分:8)
我也有这个问题。我认为您可以通过确保使用Android NDK的精确版本(android-ndk-r10e
)来解决此问题。
还要确保正确设置环境变量和内容。
(对于它的价值,我会坚持以后的步骤,但希望这可以帮助你通过这个特定的问题)
答案 1 :(得分:2)
您必须将路径更改为ANDROID_NDK才能在本地运行gradle命令。
export ANDROID_NDK=/Users/your_unix_name/android-ndk/android-ndk-r10e
就我而言,我将NDK文件放在/Users/tomo/temp/android-ndk-r10e
所以 export ANDROID_NDK = / Users / tomo / temp / android-ndk-r10e
或者,如果您不想更改ANDROID_NDK,可以更新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
}
然后更新ReactAndroid/local.properties
ndk.dir=/Users/tomo/temp/android-ndk-r10e
sdk.dir=/Applications/sdk
并从Android Studio运行应用