I am writing an android library, I need to call ReactInstanceManager.onHostResume, my contents of the build.gradle file are:
apply plugin: 'com.android.library' android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 16 targetSdkVersion 22 versionCode 1 versionName "1.0" } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "com.facebook.react:react-native:+" }
I installed it in a sample project with npm install --save react-native-mylib , and then compiled the project with react-native run-android , some errors caused:
MyModuleActivity.java:107: error: cannot find symbol mReactInstanceManager.onHostPause(); ^ symbol: method onHostPause() location: variable mReactInstanceManager of type ReactInstanceManager
I am trying to find installed interactive libraries:
find . -iname "*.jar" ... ./node_modules/react-native-mylib/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/classes.jar ./node_modules/react-native-mylib/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/libs/infer-annotations-1.5.jar ...
It seems he set response-native@0.20.1 from maven, this version of response-native does not have an onHostPause method.
EDIT:
Find libraries in another project that is associated with some libraries, all of them are connected by the old version of response-native:
$ find . -iname "*.jar" | grep com.facebook.react ./android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.25.1/jars/classes.jar ./android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.25.1/jars/libs/infer-annotations-1.5.jar ./android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.26.0/jars/classes.jar ./android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.26.0/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native/android/com/facebook/react/react-native/0.26.0/react-native-0.26.0-javadoc.jar ./node_modules/react-native/android/com/facebook/react/react-native/0.26.0/react-native-0.26.0-sources.jar ./node_modules/react-native-android-blurryoverlay/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jars/classes.jar ./node_modules/react-native-android-blurryoverlay/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.16.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-applean/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/classes.jar ./node_modules/react-native-applean/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-applean-appview/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/classes.jar ./node_modules/react-native-applean-appview/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-barcodescanner/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.19.1/jars/classes.jar ./node_modules/react-native-barcodescanner/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.19.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-camera/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.19.1/jars/classes.jar ./node_modules/react-native-camera/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.19.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-code-push/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.19.1/jars/classes.jar ./node_modules/react-native-code-push/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.19.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-device-info/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.11.0/jars/classes.jar ./node_modules/react-native-device-info/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.11.0/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-fs/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.12.0/jars/classes.jar ./node_modules/react-native-fs/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.12.0/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-mipush/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/classes.jar ./node_modules/react-native-mipush/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-orientation/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.11.0/jars/classes.jar ./node_modules/react-native-orientation/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.11.0/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-sound/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.11.0/jars/classes.jar ./node_modules/react-native-sound/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.11.0/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-sound/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.12.0/jars/classes.jar ./node_modules/react-native-sound/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.12.0/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-vector-icons/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/classes.jar ./node_modules/react-native-vector-icons/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jars/libs/infer-annotations-1.5.jar ./node_modules/react-native-vibration/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.12.0/jars/classes.jar ./node_modules/react-native-vibration/android/build/intermediates/exploded-aar/com.facebook.react/react-native/0.12.0/jars/libs/infer-annotations-1.5.jar
Question: How to configure it to use node_modules / response-native / android correctly?
EDIT: resolved, just install the correct repositories for:
repositories { mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$projectDir/../../../node_modules/react-native/android" } }
android react-native
Jacky lee
source share