Error inflating class com.google.ads.AdView

前端 未结 7 2103
余生分开走
余生分开走 2020-11-27 06:55

Hello I am new to android dev and admob. I am trying to make a simple test app with a button, a couple pages and admob at the bottom. Everything works fine until I try imple

相关标签:
7条回答
  • 2020-11-27 06:59

    In Android Studio: 1. Paste the Google AdMob SDK into the libs folder for your project 2. Add an entry to dependencies section of your build.gradle for the project pointing at the jar. 3. Rebuild your project

    dependencies {
    ...
    compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar', '... other entries...')
    }
    

    Note that compile files takes multiple jar entries. If you already have a compile files entry you can just add to it by separating entries with a comma.

    0 讨论(0)
  • 2020-11-27 07:02

    I was experiencing this, too. The build path didn't seem to work no matter what I did. So I exited Eclipse, created a new libs folder in the workbench package directory. Added the GoogleAdMobAdsSdk-6.0.1.jar to that folder. I DID NOT add the whole SDK, just the jar file. Then restarted Eclipse. I had to refresh the project inspector column to show the changes I made outside of Eclipse. It showed the new libs folder and jar file, but it still didn't work... Then I right clicked on the new libs folder and set it as a SOURCE FOLDER. NOW EVERYTHING WORKS!

    Im using Eclipse Version: Indigo Service Release 2 Build id: 20120216-1857

    Android Development Tools 18.0.0.v201203301601-306762

    It seems that maybe the tools are ahead of the documentation... or some kind of Eclipse bug.... Very aggravating!

    0 讨论(0)
  • 2020-11-27 07:14

    I had the same problem and noticed that ordering the export list is also important.
    This is mine, this way it works:

    enter image description here

    0 讨论(0)
  • 2020-11-27 07:14

    What I did - is working for me now - API Level 17 For admob:
    - Add adview code to your Layout with appropriate ID
    - Add Admob manifest code to your project manifest file
    - Add an external GoogleAdmobAdsSDK....jar Jar file to your Library (in Properties\Java Build path)
    - Check to choose GoogleAdmobAdsSDK....jar in tab Order and Export
    - Restart your ADT

    DEGUB = WORKING NOW.

    0 讨论(0)
  • 2020-11-27 07:15

    Have you recently updated your Android Tools to r17 or higher? If so, you need to create a libs/ folder in your project, and physically put the SDK in the project. Or, in the Java Build Path, you must Order and Export the SDK jar.

    Otherwise, the jar doesn't get included when your apk gets compiled, and all hell breaks loose when you run AdMob code at runtime.

    NOTE: This applies to any library your project references.

    0 讨论(0)
  • 2020-11-27 07:16

    The same error appears to me and i solved with few simple steps You need to remove the appcombat dependency from your project for removing right click your project->android->remove app combat and make sure you have selected android 4.2.2 and then import the google admob jar into your project.

    0 讨论(0)
提交回复
热议问题