Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] v0.22.5 doesn't compile with RN 0.33 #311

Closed
hirviid opened this issue Sep 14, 2016 · 11 comments
Closed

[Android] v0.22.5 doesn't compile with RN 0.33 #311

hirviid opened this issue Sep 14, 2016 · 11 comments

Comments

@hirviid
Copy link

hirviid commented Sep 14, 2016

Compilation fails (both dev and release) for version 0.22.5, with error: cannot find symbol import com.facebook.react.bridge.BaseActivityEventListener:

/Users/david/...../node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerActivityEventListener.java:6: error: cannot find symbol
import com.facebook.react.bridge.BaseActivityEventListener;
                                ^
  symbol:   class BaseActivityEventListener
  location: package com.facebook.react.bridge
/Users/david/...../node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerActivityEventListener.java:10: error: cannot find symbol
public class ImagePickerActivityEventListener extends BaseActivityEventListener {
                                                      ^
  symbol: class BaseActivityEventListener
/Users/david/...../node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerActivityEventListener.java:15: error: incompatible types: ImagePickerActivityEventListener cannot be converted to ActivityEventListener
        reactContext.addActivityEventListener(this);
@marcshilling
Copy link
Contributor

Hard to believe...I was just working on this yesterday. Don't forget to npm install and run a gradle sync again.

@hirviid
Copy link
Author

hirviid commented Sep 14, 2016

Your example works indeed, will try to find why it fails in my project and let you know.

@marcshilling
Copy link
Contributor

A few things to check:

  • In the project build.gradle, make sure the allprojects declaration looks like this:
allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}
  • In the app build.gradle, ensure react-native is compiled like this:
compile "com.facebook.react:react-native:+"  // From node_modules

And for good measure, run ./gradlew clean inside the android/ directory.

@hirviid
Copy link
Author

hirviid commented Sep 14, 2016

Thanks @marcshilling !
Indeed, I had a build.gradle from an older react-native version, with url "$projectDir/../../node_modules/react-native/android".

I changed it and now it works perfectly.

Thank you for your quick response.

@hirviid hirviid closed this as completed Sep 14, 2016
@mcatmos
Copy link

mcatmos commented Oct 14, 2016

Hi! I have the same problem, but I couldnt fixed, please @hirviid could you be more specific?

@hirviid
Copy link
Author

hirviid commented Oct 17, 2016

Hi @mcatmos, I created a new project with react-native init tempProject and compared the android specific files with my project (initially created with RN 0.27.2). For me, changing url in android/build.gradle to "$rootDir/../node_modules/react-native/android" fixed it.

@agrass
Copy link

agrass commented Nov 3, 2016

Hi! I changed to "$rootDir/../node_modules/react-native/android" but still the same problem. I'm with RN 0.26.2

@ghost
Copy link

ghost commented Nov 29, 2016

i met this issue a week ago,so sad
For me, url in android/build.gradle

image

image

output

image

@marcshilling
Copy link
Contributor

@liuliangsir2016 your code is incorrect. Your build.gradle url needs to be exactly url "$rootDir/../node_modules/react-native/android". Then run clean and build.

@ghost
Copy link

ghost commented Dec 2, 2016

@marcshilling thx,it works

@booboothefool
Copy link

Today I learned you can't do this:

android/build.gradle

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
          url "$rootDir/../node_modules/react-native/android"
          url 'https://github.com/500px/500px-android-blur/raw/master/releases/'
        }
    }
}

gotta split up the maven stuff (I didn't even know what maven was)

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
          url "$rootDir/../node_modules/react-native/android"
        }
        maven {
          url 'https://github.com/500px/500px-android-blur/raw/master/releases/'
        }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants