DylanVann / react-native-fast-image

đźš© FastImage, performant React Native image component.
MIT License
8.22k stars 1.51k forks source link

Android build failed.( ios ok) compileReleaseJavaWithJavac FAILED #47

Closed DanGDroid closed 6 years ago

DanGDroid commented 7 years ago

hi, first installed package on ios it builds success . but Android it fails:

`:react-native-fast-image:prepareComFacebookFrescoImagepipeline101Library :react-native-fast-image:prepareComFacebookFrescoImagepipelineBase101Library :react-native-fast-image:prepareComFacebookFrescoImagepipelineOkhttp3101Library :react-native-fast-image:prepareComFacebookReactReactNative0451Library :react-native-fast-image:prepareComFacebookSoloaderSoloader010Library :react-native-fast-image:prepareOrgWebkitAndroidJscR174650Library :react-native-fast-image:prepareReleaseDependencies :react-native-fast-image:compileReleaseAidl :react-native-fast-image:compileReleaseNdk UP-TO-DATE :react-native-fast-image:compileLint :react-native-fast-image:copyReleaseLint UP-TO-DATE :react-native-fast-image:compileReleaseRenderscript :react-native-fast-image:generateReleaseBuildConfig :react-native-fast-image:generateReleaseResValues :react-native-fast-image:generateReleaseResources :react-native-fast-image:mergeReleaseResources :react-native-fast-image:processReleaseManifest /..../node_modules/react-native-fast-image/android/src/main/AndroidManifest.xml:11:9-15:15 Warning: meta-data#com.bumptech.glide.integration.okhttp.OkHttpGlideModule was tagged at AndroidManifest.xml:11 to remove other declarations but no other declaration present :react-native-fast-image:processReleaseResources :react-native-fast-image:generateReleaseSources :react-native-fast-image:incrementalReleaseJavaCompilationSafeguard :react-native-fast-image:compileReleaseJavaWithJavac :react-native-fast-image:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). /..../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: /..../node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error :react-native-fast-image:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 8.256 secs`

DanGDroid commented 7 years ago

when i edit 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(); } it runs fine. do you have a permanent fix?

isAlmogK commented 7 years ago

+1 I'm having the same issue

I already have the following and still getting the issue

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

update RN to 0.47 did not solve this issue.

isAlmogK commented 7 years ago

Any updates on this?

hmenzagh commented 7 years ago

Same here

isAlmogK commented 7 years ago

I was able to fix this by doing the following

Comment out the following code in FastImageView Package

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

And also in react video package not sure if it's related

//@Override
    //public List<Class<? extends JavaScriptModule>> createJSModules() {
        //return Collections.emptyList();
    //}
mkhalil49 commented 7 years ago

I ran in same problem but i discovered that i have old version of this package installed if you see the latest version you will not see this methods so after i did npm uninstall react-native-fast-image then npm install react-native-fast-image fixed

mkhalil49 commented 7 years ago

48

brkrtp commented 7 years ago

same +1

rishabhsaxena9 commented 7 years ago

update your fast image package file by this:---

package com.dylanvann.fastimage; import com.dylanvann.fastimage.FastImageViewModule; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager;

import java.util.Collections; import java.util.List;

public class FastImageViewPackage implements ReactPackage { @Override public List createNativeModules(ReactApplicationContext reactContext) { return Collections.singletonList(new FastImageViewModule(reactContext)); }

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.<ViewManager>singletonList(new FastImageViewManager());
}

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

}

hmenzagh commented 7 years ago

@rishabhsaxena9 This didn't do the trick on the last version

Billydubb commented 7 years ago

@DanGDroid 's solution fixed it for me. @DylanVann, should I create a PR with those changes?

signorekai commented 7 years ago

@DanGDroid 's solution fixed it for me too. @Billydubb will you be creating that PR?

Billydubb commented 7 years ago

Done https://github.com/DylanVann/react-native-fast-image/pull/71

shopfue commented 7 years ago

worked for me ! +1

gianpaj commented 6 years ago

https://github.com/DylanVann/react-native-fast-image/issues/47#issuecomment-323577547 fixed this issue on react-native 0.51.0. please merge https://github.com/DylanVann/react-native-fast-image/pull/71

Note that the createJSModules() method needs to be inside the FastImageViewPackage class.

error without the method:

$ yarn list --pattern fast-image
└─ react-native-fast-image@2.0.1

$ cd android && ./gradlew installDebug --stacktrace --debug

11:36:36.662 [INFO] [org.gradle.api.internal.tasks.compile.JdkJavaCompiler] Compiling with JDK Java compiler API.
11:36:36.765 [ERROR] [system.err] /Users/gianfranco/app/mobileapp/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
11:36:36.765 [ERROR] [system.err] public class FastImageViewPackage implements ReactPackage {
11:36:36.765 [ERROR] [system.err]        ^
11:36:36.781 [ERROR] [system.err] Note: /Users/gianfranco/app/mobileapp/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java uses unchecked or unsafe operations.
11:36:36.781 [ERROR] [system.err] Note: Recompile with -Xlint:unchecked for details.
11:36:36.781 [ERROR] [system.err] 1 error
11:36:36.786 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':react-native-fast-image:compileReleaseJavaWithJavac'
11:36:36.786 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :react-native-fast-image:compileReleaseJavaWithJavac FAILED
11:36:36.786 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :react-native-fast-image:compileReleaseJavaWithJavac (Thread[Daemon worker Thread 6,5,main]) completed. Took 0.155 secs.
11:36:36.787 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 6,5,main]] finished, busy: 0.315 secs, idle: 0.007 secs
11:36:36.788 [ERROR] [org.gradle.BuildExceptionReporter]
11:36:36.788 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:36:36.788 [ERROR] [org.gradle.BuildExceptionReporter]
11:36:36.788 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
11:36:36.788 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':react-native-fast-image:compileReleaseJavaWithJavac'.
11:36:36.788 [ERROR] [org.gradle.BuildExceptionReporter] > Compilation failed; see the compiler error output for details.
DylanVann commented 6 years ago

createJSModules is removed in newer React Native versions (>0.47.0). If you update you will not have this issue.

To simplify development of this package I'm only aiming to support the latest version, it may work for others, but I'm not including code for backward compatibility:

https://github.com/DylanVann/react-native-fast-image#supported-react-native-versions