Cannot import com.google.android.gms:play-services-ads:17.1.1












1















apply plugin: 'com.android.application'
android {
compileSdkVersion 28

defaultConfig {
applicationId "com.kaiboon0216gmail.homeownerstarterkit"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}


These are my codes.I'm using Admob to display the ads in my app.When I add this code:"'com.google.android.gms:play-services-ads:17.1.1'" and sync , my apps crash.



After that I go to Admob official website and found that this version is for 'com.android.support:appcompat-v7:26.1.0' version. But when I change the compileSdkVersion to 26, my apps still crash....



I have test the code without this code:"'com.google.android.gms:play-services-ads:17.1.1'" and it can run.Im sure that this code is the problem but i have no idea how to correct it.



Could anyone help to solve my problem?
Thank you.










share|improve this question




















  • 2





    just use 15.0.1 instead.

    – V-rund Puro-hit
    Nov 14 '18 at 6:16






  • 1





    add your logcat trace

    – masoud vali
    Nov 14 '18 at 6:17






  • 1





    If the app crashes, we cannot really help without the logcat

    – cricket_007
    Nov 14 '18 at 6:17











  • How to add logcat trace?

    – Chang Kai Boon
    Nov 14 '18 at 6:33
















1















apply plugin: 'com.android.application'
android {
compileSdkVersion 28

defaultConfig {
applicationId "com.kaiboon0216gmail.homeownerstarterkit"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}


These are my codes.I'm using Admob to display the ads in my app.When I add this code:"'com.google.android.gms:play-services-ads:17.1.1'" and sync , my apps crash.



After that I go to Admob official website and found that this version is for 'com.android.support:appcompat-v7:26.1.0' version. But when I change the compileSdkVersion to 26, my apps still crash....



I have test the code without this code:"'com.google.android.gms:play-services-ads:17.1.1'" and it can run.Im sure that this code is the problem but i have no idea how to correct it.



Could anyone help to solve my problem?
Thank you.










share|improve this question




















  • 2





    just use 15.0.1 instead.

    – V-rund Puro-hit
    Nov 14 '18 at 6:16






  • 1





    add your logcat trace

    – masoud vali
    Nov 14 '18 at 6:17






  • 1





    If the app crashes, we cannot really help without the logcat

    – cricket_007
    Nov 14 '18 at 6:17











  • How to add logcat trace?

    – Chang Kai Boon
    Nov 14 '18 at 6:33














1












1








1








apply plugin: 'com.android.application'
android {
compileSdkVersion 28

defaultConfig {
applicationId "com.kaiboon0216gmail.homeownerstarterkit"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}


These are my codes.I'm using Admob to display the ads in my app.When I add this code:"'com.google.android.gms:play-services-ads:17.1.1'" and sync , my apps crash.



After that I go to Admob official website and found that this version is for 'com.android.support:appcompat-v7:26.1.0' version. But when I change the compileSdkVersion to 26, my apps still crash....



I have test the code without this code:"'com.google.android.gms:play-services-ads:17.1.1'" and it can run.Im sure that this code is the problem but i have no idea how to correct it.



Could anyone help to solve my problem?
Thank you.










share|improve this question
















apply plugin: 'com.android.application'
android {
compileSdkVersion 28

defaultConfig {
applicationId "com.kaiboon0216gmail.homeownerstarterkit"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}


These are my codes.I'm using Admob to display the ads in my app.When I add this code:"'com.google.android.gms:play-services-ads:17.1.1'" and sync , my apps crash.



After that I go to Admob official website and found that this version is for 'com.android.support:appcompat-v7:26.1.0' version. But when I change the compileSdkVersion to 26, my apps still crash....



I have test the code without this code:"'com.google.android.gms:play-services-ads:17.1.1'" and it can run.Im sure that this code is the problem but i have no idea how to correct it.



Could anyone help to solve my problem?
Thank you.







java android admob google-play-services






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 9:24









Utkarsh Srivastava

718




718










asked Nov 14 '18 at 6:15









Chang Kai BoonChang Kai Boon

814




814








  • 2





    just use 15.0.1 instead.

    – V-rund Puro-hit
    Nov 14 '18 at 6:16






  • 1





    add your logcat trace

    – masoud vali
    Nov 14 '18 at 6:17






  • 1





    If the app crashes, we cannot really help without the logcat

    – cricket_007
    Nov 14 '18 at 6:17











  • How to add logcat trace?

    – Chang Kai Boon
    Nov 14 '18 at 6:33














  • 2





    just use 15.0.1 instead.

    – V-rund Puro-hit
    Nov 14 '18 at 6:16






  • 1





    add your logcat trace

    – masoud vali
    Nov 14 '18 at 6:17






  • 1





    If the app crashes, we cannot really help without the logcat

    – cricket_007
    Nov 14 '18 at 6:17











  • How to add logcat trace?

    – Chang Kai Boon
    Nov 14 '18 at 6:33








2




2





just use 15.0.1 instead.

– V-rund Puro-hit
Nov 14 '18 at 6:16





just use 15.0.1 instead.

– V-rund Puro-hit
Nov 14 '18 at 6:16




1




1





add your logcat trace

– masoud vali
Nov 14 '18 at 6:17





add your logcat trace

– masoud vali
Nov 14 '18 at 6:17




1




1





If the app crashes, we cannot really help without the logcat

– cricket_007
Nov 14 '18 at 6:17





If the app crashes, we cannot really help without the logcat

– cricket_007
Nov 14 '18 at 6:17













How to add logcat trace?

– Chang Kai Boon
Nov 14 '18 at 6:33





How to add logcat trace?

– Chang Kai Boon
Nov 14 '18 at 6:33












3 Answers
3






active

oldest

votes


















2














Because with "com.google.android.gms:play-services-ads:17.1.1"
You need to update something.



You have to Update your AndroidManifest.xml



<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
</manifest>


And with this:



<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
</application>
</manifest>


You can check these links for more detail informations.



https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start#update_your_androidmanifestxml



https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml



Otherwise You have to use "com.google.android.gms:play-services-ads:16.0.0"






share|improve this answer































    1














    Use "com.google.android.gms:play-services-ads:16.0.0", the new 17.1.1 change some code implementation, ie, you need do that in ur source too, or back to 16.0.0 for now...



    will fix your error for while...






    share|improve this answer































      0














      Go to Admob - Select App - App Setting - App ID copy the value from App ID



      Now add this (change this android:value="paste the App ID value you copy from your admob app" )



      <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-111100000000~1111111"/>


      meta-data into AndroidManifest.xml file



      No need to add anything in APPLICATION_ID from android:name="com.google.android.gms.ads.APPLICATION_ID"



      This will work!



      See the picture below for clear understanding



      enter image description here






      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%2f53294162%2fcannot-import-com-google-android-gmsplay-services-ads17-1-1%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        Because with "com.google.android.gms:play-services-ads:17.1.1"
        You need to update something.



        You have to Update your AndroidManifest.xml



        <manifest>
        <application>
        <meta-data
        android:name="com.google.android.gms.ads.AD_MANAGER_APP"
        android:value="true"/>
        </application>
        </manifest>


        And with this:



        <manifest>
        <application>
        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="[ADMOB_APP_ID]"/>
        </application>
        </manifest>


        You can check these links for more detail informations.



        https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start#update_your_androidmanifestxml



        https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml



        Otherwise You have to use "com.google.android.gms:play-services-ads:16.0.0"






        share|improve this answer




























          2














          Because with "com.google.android.gms:play-services-ads:17.1.1"
          You need to update something.



          You have to Update your AndroidManifest.xml



          <manifest>
          <application>
          <meta-data
          android:name="com.google.android.gms.ads.AD_MANAGER_APP"
          android:value="true"/>
          </application>
          </manifest>


          And with this:



          <manifest>
          <application>
          <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
          <meta-data
          android:name="com.google.android.gms.ads.APPLICATION_ID"
          android:value="[ADMOB_APP_ID]"/>
          </application>
          </manifest>


          You can check these links for more detail informations.



          https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start#update_your_androidmanifestxml



          https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml



          Otherwise You have to use "com.google.android.gms:play-services-ads:16.0.0"






          share|improve this answer


























            2












            2








            2







            Because with "com.google.android.gms:play-services-ads:17.1.1"
            You need to update something.



            You have to Update your AndroidManifest.xml



            <manifest>
            <application>
            <meta-data
            android:name="com.google.android.gms.ads.AD_MANAGER_APP"
            android:value="true"/>
            </application>
            </manifest>


            And with this:



            <manifest>
            <application>
            <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
            <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="[ADMOB_APP_ID]"/>
            </application>
            </manifest>


            You can check these links for more detail informations.



            https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start#update_your_androidmanifestxml



            https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml



            Otherwise You have to use "com.google.android.gms:play-services-ads:16.0.0"






            share|improve this answer













            Because with "com.google.android.gms:play-services-ads:17.1.1"
            You need to update something.



            You have to Update your AndroidManifest.xml



            <manifest>
            <application>
            <meta-data
            android:name="com.google.android.gms.ads.AD_MANAGER_APP"
            android:value="true"/>
            </application>
            </manifest>


            And with this:



            <manifest>
            <application>
            <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
            <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="[ADMOB_APP_ID]"/>
            </application>
            </manifest>


            You can check these links for more detail informations.



            https://developers.google.com/ad-manager/mobile-ads-sdk/android/quick-start#update_your_androidmanifestxml



            https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml



            Otherwise You have to use "com.google.android.gms:play-services-ads:16.0.0"







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 '18 at 11:21









            Emre TekinEmre Tekin

            240415




            240415

























                1














                Use "com.google.android.gms:play-services-ads:16.0.0", the new 17.1.1 change some code implementation, ie, you need do that in ur source too, or back to 16.0.0 for now...



                will fix your error for while...






                share|improve this answer




























                  1














                  Use "com.google.android.gms:play-services-ads:16.0.0", the new 17.1.1 change some code implementation, ie, you need do that in ur source too, or back to 16.0.0 for now...



                  will fix your error for while...






                  share|improve this answer


























                    1












                    1








                    1







                    Use "com.google.android.gms:play-services-ads:16.0.0", the new 17.1.1 change some code implementation, ie, you need do that in ur source too, or back to 16.0.0 for now...



                    will fix your error for while...






                    share|improve this answer













                    Use "com.google.android.gms:play-services-ads:16.0.0", the new 17.1.1 change some code implementation, ie, you need do that in ur source too, or back to 16.0.0 for now...



                    will fix your error for while...







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 14 '18 at 23:16









                    RodrigoRodrigo

                    111




                    111























                        0














                        Go to Admob - Select App - App Setting - App ID copy the value from App ID



                        Now add this (change this android:value="paste the App ID value you copy from your admob app" )



                        <meta-data
                        android:name="com.google.android.gms.ads.APPLICATION_ID"
                        android:value="ca-app-pub-111100000000~1111111"/>


                        meta-data into AndroidManifest.xml file



                        No need to add anything in APPLICATION_ID from android:name="com.google.android.gms.ads.APPLICATION_ID"



                        This will work!



                        See the picture below for clear understanding



                        enter image description here






                        share|improve this answer




























                          0














                          Go to Admob - Select App - App Setting - App ID copy the value from App ID



                          Now add this (change this android:value="paste the App ID value you copy from your admob app" )



                          <meta-data
                          android:name="com.google.android.gms.ads.APPLICATION_ID"
                          android:value="ca-app-pub-111100000000~1111111"/>


                          meta-data into AndroidManifest.xml file



                          No need to add anything in APPLICATION_ID from android:name="com.google.android.gms.ads.APPLICATION_ID"



                          This will work!



                          See the picture below for clear understanding



                          enter image description here






                          share|improve this answer


























                            0












                            0








                            0







                            Go to Admob - Select App - App Setting - App ID copy the value from App ID



                            Now add this (change this android:value="paste the App ID value you copy from your admob app" )



                            <meta-data
                            android:name="com.google.android.gms.ads.APPLICATION_ID"
                            android:value="ca-app-pub-111100000000~1111111"/>


                            meta-data into AndroidManifest.xml file



                            No need to add anything in APPLICATION_ID from android:name="com.google.android.gms.ads.APPLICATION_ID"



                            This will work!



                            See the picture below for clear understanding



                            enter image description here






                            share|improve this answer













                            Go to Admob - Select App - App Setting - App ID copy the value from App ID



                            Now add this (change this android:value="paste the App ID value you copy from your admob app" )



                            <meta-data
                            android:name="com.google.android.gms.ads.APPLICATION_ID"
                            android:value="ca-app-pub-111100000000~1111111"/>


                            meta-data into AndroidManifest.xml file



                            No need to add anything in APPLICATION_ID from android:name="com.google.android.gms.ads.APPLICATION_ID"



                            This will work!



                            See the picture below for clear understanding



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 23 '18 at 8:33









                            Tahmid Bin RashidTahmid Bin Rashid

                            30625




                            30625






























                                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.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294162%2fcannot-import-com-google-android-gmsplay-services-ads17-1-1%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

                                Xamarin.iOS Cant Deploy on Iphone

                                Glorious Revolution

                                Dulmage-Mendelsohn matrix decomposition in Python