(Google ?) Sample code does not build

224 views
Skip to first unread message

Johan van der Hoeven

unread,
Apr 6, 2014, 4:27:03 PM4/6/14
to google-adm...@googlegroups.com
Hello,
first post so I hope it follows the guide lines.

I found this:
https://github.com/googleads/googleads-mobile-android-examples/tree/master/admob/banner


It will not build unless:
<meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />
             
              

Is changed to:
<meta-data android:name="com.google.android.gms.version"
               android:value="4323000" />
//^^ runs fine

I found "4323000" by calling:
Log.w("MEEP", "Play Services Version id: " + GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE);









Amy Quispe (AdMob SDK Team)

unread,
Apr 7, 2014, 7:14:53 PM4/7/14
to google-adm...@googlegroups.com
Hi Johan,

Yes, you can hardcode the GPS version if you'd like, but this would mean that it won't work with the automatic updates that get pushed out, and that you'll have to change this value when you upgrade to newer versions of GPS.

I'm surprised to hear that the sample doesn't build for you. Can you tell me a little bit more about how you're importing the project?

Amy Quispe

Johan van der Hoeven

unread,
Apr 7, 2014, 9:09:26 PM4/7/14
to google-adm...@googlegroups.com
Hi Amy,
I just did 'interstitial' so I would remember all the steps:


1)
Import > Android > Existing code into workspace
pick ~/sampl/admob/interstitial
Finish

2)
Add external jars:
~/android-sdks/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar

I look in the tab 'Order and Export'
It is last. Does not matter if I move it to the top.


Does not build:


        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

//BTW: (google-play-services.jar --was installed 3 days ago)

I need the XML to work.

Thanks for any ideas you may have,
-Johan

Amy Quispe (AdMob SDK Team)

unread,
Apr 8, 2014, 1:43:41 PM4/8/14
to google-adm...@googlegroups.com
Hi Johan,

Instead of adding external jars, you should add it as a library resource. You can see instructions on how to do that here.

Amy Quispe

Johan van der Hoeven

unread,
Apr 8, 2014, 4:23:02 PM4/8/14
to google-adm...@googlegroups.com
Thank you Amy.

I got banner-xml running.

The only odd thing is that I had to replace the content of
proguard-project.txt
with the stuff further down on the install web page.

If not:
logcat
Binary XML file line #10: Error inflating class com.google.android.gms.ads.AdView

The only thing I did not do:
"Note: You should be referencing a copy of the library that you copied to your development workspace—you should not reference the library directly from the Android SDK directory."

Anyhow I can work now.

Next time I'll read the instructions.

Thanks,
-Johan
Reply all
Reply to author
Forward
0 new messages