Error when using Maps in react native
I want to use maps in my react native app. So I installed react-native-maps from airbnb, but when I try to build the apps it always shows this error "Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler."
, I already set up the build gradle, the setting gradle, and the MainApllication. Can anyone help me in here?
My Build.Gradle
dependencies {
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
My Setting.Gradle
rootProject.name = 'MapDemo'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':app'
My MainApplication.Java
import com.airbnb.android.react.maps.MapsPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage()
);
}
android reactjs google-maps react-native
add a comment |
I want to use maps in my react native app. So I installed react-native-maps from airbnb, but when I try to build the apps it always shows this error "Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler."
, I already set up the build gradle, the setting gradle, and the MainApllication. Can anyone help me in here?
My Build.Gradle
dependencies {
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
My Setting.Gradle
rootProject.name = 'MapDemo'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':app'
My MainApplication.Java
import com.airbnb.android.react.maps.MapsPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage()
);
}
android reactjs google-maps react-native
Just to be sure, have you edited the build.gradlew in theandroid/app/build.gradle
?
– Pritish Vaidya
Apr 12 at 11:06
Guyz its gradle version issue , please check this stackoverflow answer
– vijay
Jun 9 at 19:54
add a comment |
I want to use maps in my react native app. So I installed react-native-maps from airbnb, but when I try to build the apps it always shows this error "Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler."
, I already set up the build gradle, the setting gradle, and the MainApllication. Can anyone help me in here?
My Build.Gradle
dependencies {
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
My Setting.Gradle
rootProject.name = 'MapDemo'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':app'
My MainApplication.Java
import com.airbnb.android.react.maps.MapsPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage()
);
}
android reactjs google-maps react-native
I want to use maps in my react native app. So I installed react-native-maps from airbnb, but when I try to build the apps it always shows this error "Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler."
, I already set up the build gradle, the setting gradle, and the MainApllication. Can anyone help me in here?
My Build.Gradle
dependencies {
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
My Setting.Gradle
rootProject.name = 'MapDemo'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':app'
My MainApplication.Java
import com.airbnb.android.react.maps.MapsPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage()
);
}
android reactjs google-maps react-native
android reactjs google-maps react-native
edited Apr 12 at 12:25
Sarjit Delivala
3801821
3801821
asked Apr 12 at 10:26
Theodorus Agum Gumilang
289218
289218
Just to be sure, have you edited the build.gradlew in theandroid/app/build.gradle
?
– Pritish Vaidya
Apr 12 at 11:06
Guyz its gradle version issue , please check this stackoverflow answer
– vijay
Jun 9 at 19:54
add a comment |
Just to be sure, have you edited the build.gradlew in theandroid/app/build.gradle
?
– Pritish Vaidya
Apr 12 at 11:06
Guyz its gradle version issue , please check this stackoverflow answer
– vijay
Jun 9 at 19:54
Just to be sure, have you edited the build.gradlew in the
android/app/build.gradle
?– Pritish Vaidya
Apr 12 at 11:06
Just to be sure, have you edited the build.gradlew in the
android/app/build.gradle
?– Pritish Vaidya
Apr 12 at 11:06
Guyz its gradle version issue , please check this stackoverflow answer
– vijay
Jun 9 at 19:54
Guyz its gradle version issue , please check this stackoverflow answer
– vijay
Jun 9 at 19:54
add a comment |
2 Answers
2
active
oldest
votes
I faced a similar issue and found the solution from here:
Navigate to node_modules/react-native-maps/lib/android/build.gradle
and then
change compileOnly
to provided
and implementation
to compile
.
I hope this helps.
1
this removes the error but the map does not load
– pixel
May 4 at 3:13
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
add a comment |
Changing a file in the third-party module you're using is probably not the best solution to most problems. It seems that this error is caused because the module has been upgraded to use gradle 3, which is incompatible with the gradle 2 version used by default in react native. There are useful steps to upgrade here: https://github.com/react-native-community/react-native-camera/issues/1490
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49794160%2ferror-when-using-maps-in-react-native%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I faced a similar issue and found the solution from here:
Navigate to node_modules/react-native-maps/lib/android/build.gradle
and then
change compileOnly
to provided
and implementation
to compile
.
I hope this helps.
1
this removes the error but the map does not load
– pixel
May 4 at 3:13
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
add a comment |
I faced a similar issue and found the solution from here:
Navigate to node_modules/react-native-maps/lib/android/build.gradle
and then
change compileOnly
to provided
and implementation
to compile
.
I hope this helps.
1
this removes the error but the map does not load
– pixel
May 4 at 3:13
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
add a comment |
I faced a similar issue and found the solution from here:
Navigate to node_modules/react-native-maps/lib/android/build.gradle
and then
change compileOnly
to provided
and implementation
to compile
.
I hope this helps.
I faced a similar issue and found the solution from here:
Navigate to node_modules/react-native-maps/lib/android/build.gradle
and then
change compileOnly
to provided
and implementation
to compile
.
I hope this helps.
answered Apr 12 at 14:25
Sarjit Delivala
3801821
3801821
1
this removes the error but the map does not load
– pixel
May 4 at 3:13
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
add a comment |
1
this removes the error but the map does not load
– pixel
May 4 at 3:13
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
1
1
this removes the error but the map does not load
– pixel
May 4 at 3:13
this removes the error but the map does not load
– pixel
May 4 at 3:13
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
Instead of changing the library you can follow this (itnext.io/…)
– RDD
Aug 7 at 11:07
add a comment |
Changing a file in the third-party module you're using is probably not the best solution to most problems. It seems that this error is caused because the module has been upgraded to use gradle 3, which is incompatible with the gradle 2 version used by default in react native. There are useful steps to upgrade here: https://github.com/react-native-community/react-native-camera/issues/1490
add a comment |
Changing a file in the third-party module you're using is probably not the best solution to most problems. It seems that this error is caused because the module has been upgraded to use gradle 3, which is incompatible with the gradle 2 version used by default in react native. There are useful steps to upgrade here: https://github.com/react-native-community/react-native-camera/issues/1490
add a comment |
Changing a file in the third-party module you're using is probably not the best solution to most problems. It seems that this error is caused because the module has been upgraded to use gradle 3, which is incompatible with the gradle 2 version used by default in react native. There are useful steps to upgrade here: https://github.com/react-native-community/react-native-camera/issues/1490
Changing a file in the third-party module you're using is probably not the best solution to most problems. It seems that this error is caused because the module has been upgraded to use gradle 3, which is incompatible with the gradle 2 version used by default in react native. There are useful steps to upgrade here: https://github.com/react-native-community/react-native-camera/issues/1490
answered Apr 20 at 17:44
Jules
9,71535898
9,71535898
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49794160%2ferror-when-using-maps-in-react-native%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Just to be sure, have you edited the build.gradlew in the
android/app/build.gradle
?– Pritish Vaidya
Apr 12 at 11:06
Guyz its gradle version issue , please check this stackoverflow answer
– vijay
Jun 9 at 19:54