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

RN0.29 compatability #363

Merged
merged 2 commits into from
Jul 8, 2016
Merged

Conversation

locly
Copy link

@locly locly commented Jul 7, 2016

React native 0.29 has some changes to the way they initialize libraries, which means they are initialized from the Application rather than the MainActivity. We added the Activity as a constructor argument to MapsPackage in PR#276 to fix Sony Xperia devices with Android 6.0 crashing #271.

After some experimentation and testing we've found that if you supply ReactContext.getBaseContext() to the Google Maps API you can get away with not needing the MainActivity. I have also left the public MapsPackage(Activity activity) { } constructor for backwards compatibility, but if you'd rather this was removed, let me know and I'll update the PR.

I've also updated the build.gradle file as per #359 to get the lib building with RN0.29.

Tested with:
Nexus 6P
Nexus 5
Sony Xperia z5 compact

@shtefanntz
Copy link

Thanks for the PR!
it would be great if this branch would be published to NPM so we can use it with rn0.29

@julien-rodrigues
Copy link
Contributor

Hey,

should the path of the file to update be pointing to MainApplication.java ?

https://github.com/lelandrichardson/react-native-maps/pull/363/files#diff-11d8910b58f5c70ccb3bedc0f37c892fR60

@christopherdro
Copy link
Collaborator

Oops! I didn't see this and ended up submitting #366

@christopherdro
Copy link
Collaborator

I don't think you need to pass context through again and can use ThemeReactContext. Take a look at my PR if you get a chance. Maybe we can consolidate both our ideas into this PR and close mine out?

@christopherdro
Copy link
Collaborator

@julien-rodrigues Yes, the docs would have to be updated for 0.29.

We can use https://github.com/Microsoft/react-native-code-push#plugin-configuration-android
as an example.

@julien-rodrigues
Copy link
Contributor

@christopherdro Indeed it seems a great solution

@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply from: 'gradle-maven-push.gradle'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems unrelated

@lelandrichardson
Copy link
Collaborator

I'd like to get a release out for 0.29, so I'm going to go ahead and merge this. There's some gradle stuff that we might tweak before publishing though.

Thanks @locly for your contribution!

@lelandrichardson lelandrichardson merged commit c18eace into react-native-maps:master Jul 8, 2016
@npomfret
Copy link

npomfret commented Jul 14, 2016

I'm getting an Android compile error now using rn 0.29.1:

Error:A problem occurred configuring project ':react-native-maps'.
> Could not resolve all dependencies for configuration ':react-native-maps:_debugCompile'.
   > Could not find com.facebook.react:react-native:0.29.0.
     Searched in the following locations:
         file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         file:/Users/nickpomfret/.m2/repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         file:/Users/nickpomfret/.m2/repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         https://maven.fabric.io/public/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         https://maven.fabric.io/public/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         https://jcenter.bintray.com/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         https://jcenter.bintray.com/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         file:/Users/nickpomfret/Documents/github/datr/app/pomochat/node_modules/react-native/android/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         file:/Users/nickpomfret/Documents/github/datr/app/pomochat/node_modules/react-native/android/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         http://files.couchbase.com/maven2/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         http://files.couchbase.com/maven2/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         file:/Users/nickpomfret/android/extras/android/m2repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         file:/Users/nickpomfret/android/extras/android/m2repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar
         file:/Users/nickpomfret/android/extras/google/m2repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.pom
         file:/Users/nickpomfret/android/extras/google/m2repository/com/facebook/react/react-native/0.29.0/react-native-0.29.0.jar

Any idea what might cause this? What exactly are the install instructions for android now?

@julien-rodrigues
Copy link
Contributor

julien-rodrigues commented Jul 14, 2016

It's because we now require explicitly version 0.29. As stated above

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

Successfully merging this pull request may close these issues.

8 participants