Error when using Maps in react native












6














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()
);
}









share|improve this question
























  • 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
















6














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()
);
}









share|improve this question
























  • 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














6












6








6


3





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()
);
}









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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


















  • 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
















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












2 Answers
2






active

oldest

votes


















5














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.






share|improve this answer

















  • 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



















0














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






share|improve this answer





















    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    5














    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.






    share|improve this answer

















    • 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
















    5














    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.






    share|improve this answer

















    • 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














    5












    5








    5






    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.






    share|improve this answer












    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.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    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














    • 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













    0














    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






    share|improve this answer


























      0














      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






      share|improve this answer
























        0












        0








        0






        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






        share|improve this answer












        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 20 at 17:44









        Jules

        9,71535898




        9,71535898






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas