Hi all,
when i try to add adview from https://www.b4x.com/android/forum/threads/admob-tutorial-add-ads-to-your-application.7300/ every thing is ok and works fine. Problem starts when i try to add adview in project based on this tutorial ( i didnt change antything) -> https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/#post-509530. This is error
this is the line 91,92,93
when i remove this line i get this error in log ( app compiles with any error)
any advise?
ps I change admob lib to firebaseadMob and get this error
Edit:3 OK problem solved i just remove
form the code and now its works fine !
when i try to add adview from https://www.b4x.com/android/forum/threads/admob-tutorial-add-ads-to-your-application.7300/ every thing is ok and works fine. Problem starts when i try to add adview in project based on this tutorial ( i didnt change antything) -> https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/#post-509530. This is error
B4X:
B4A line: 92
Activity.AddView(adview1, 0dip, 100%y -50dip, 320
javac 1.8.0_60
src\network\assist\com\main.java:412: error: cannot access AdView
mostCurrent._activity.AddView((android.view.View)(mostCurrent._adview1.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)),(int) (anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA)-anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (320)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
^
class file for com.google.android.gms.ads.AdView not found
this is the line 91,92,93
B4X:
adview1.Initialize("Ad", "<ca-app-pub-xxxxx")
Activity.AddView(adview1, 0dip, 100%y -50dip, 320dip, 50dip)' AdView1.LoadAd 'loads an ad
adview1.LoadAd
when i remove this line i get this error in log ( app compiles with any error)
B4X:
ava.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/AdSize;
at anywheresoftware.b4a.admobwrapper.AdViewWrapper.<clinit>(AdViewWrapper.java:37)
at network.assist.com.main._globals(main.java:952)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at network.assist.com.main.initializeGlobals(main.java:312)
at network.assist.com.main.afterFirstLayout(main.java:99)
at network.assist.com.main.access$000(main.java:17)
at network.assist.com.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdSize" on path: DexPathList[[zip file "/data/app/network.assist.com-2/base.apk"],nativeLibraryDirectories=[/data/app/network.assist.com-2/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
any advise?
ps I change admob lib to firebaseadMob and get this error
B4X:
B4A version: 7.01
Parsing code. (0.01s)
Compiling code. (0.06s)
Compiling layouts code. (0.00s)
Organizing libraries. (1.47s)
Generating R file. Error
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\admob_ads_attrs.xml:10: error: Attribute "adSize" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\admob_ads_attrs.xml:17: error: Attribute "adSizes" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\admob_ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\base_attrs.xml:11: error: Attribute "buttonSize" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\base_attrs.xml:16: error: Attribute "colorScheme" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\base_attrs.xml:21: error: Attribute "scopeUris" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\common_attrs.xml:13: error: Attribute "imageAspectRatioAdjust" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\common_attrs.xml:22: error: Attribute "imageAspectRatio" has already been defined
c:\program files\android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res\values\common_attrs.xml:27: error: Attribute "circleCrop" has already been defined
Edit:3 OK problem solved i just remove
B4X:
'#AdditionalRes: C:\Program Files\Android\android-sdk\extras\google\google-play-services\libproject\google-play-services_lib\res, com.google.android.gms
form the code and now its works fine !
Last edited: