React-native : Unable to use react-native-fast-image

My apps app/build gradle:

android:compileSdkVersion 23,  buildToolsVersion '26'

android/build gradle:

subprojects { subproject ->
    afterEvaluate{
        if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion 25
                buildToolsVersion "25.0.1"
            }
        }
    }
}

package json dependencies:

"react-native-fast-image": "^1.0.0", "react": "16.0.0-alpha.12", "react-native": "0.45.1",

I have installed react-native-fast-image, and linked with react-native. Then while running on android , I am getting this error:

:react-native-fast-image:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
D:\React Practice\MyProject\MyProject\node_modules\react-native-fast-image\android\src\main\java\com\dylanvann\fastimage\FastImageViewPackage.java:14: error: FastImageViewPackage is not abstract and does not override abstract method createJSModules() in ReactPackage
public class FastImageViewPackage implements ReactPackage {
       ^
Note: D:\React Practice\MyProject\MyProject\node_modules\react-native-fast-image\android\src\main\java\com\dylanvann\fastimage\FastImageViewManager.java uses unchecked or un
safe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:react-native-fast-image:compileReleaseJavaWithJavac FAILED

This bug is already fixed on the last version of react-native-fast-image.

Or you can fix it manually my editing node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewPackage.java and add:

@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}

Also, if you have upgrade your react-native to a version greater than 0.47.0 (in your example you are using 0.45.1), you need to remove the @Override annotation.

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue