Posts tagged with android

Description: I am only using com.google.android.gms packaged classes for AD Id and Remote config and all the code is being run on IO Dispatcher. I feel this is happening internally on Google's side. Still I want your inputs how this can be fixed from my side or whether it can be fixed or not?

Full stack trace:

at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1659) at libcore.io.BlockGuardOs.stat(BlockGuardOs.java:419) at libcore.io.ForwardingOs.stat(ForwardingOs.java:846) at android.app.ActivityThread$AndroidOs.stat(ActivityThread.java:8143) at java.io.UnixFileSystem.getLength(UnixFileSystem.java:330) at java.io.File.length(File.java:968) at auen.a(:com.google.android.gms@233717044@23.37.17 (190400-570218080):25) at aufq.e(:com.google.android.gms@233717044@23.37.17 (190400-570218080):252) at aufq.b(:com.google.android.gms@233717044@23.37.17 (190400-570218080):450) at auft.query(:com.google.android.gms@233717044@23.37.17 (190400-570218080):141) at aevp.query(:com.google.android.gms@233717044@23.37.17 (190400-570218080):3) at android.content.ContentProvider.query(ContentProvider.java:1417) at mgp.superQuery(:com.google.android.gms@233717044@23.37.17 (190400-570218080):2) at com.google.android.chimera.ContentProvider.query(:com.google.android.gms@233717044@23.37.17 (190400-570218080):2) at aevp.query(:com.google.android.gms@233717044@23.37.17 (190400-570218080):20) at android.content.ContentProvider.query(ContentProvider.java:1513) at mgp.superQuery(:com.google.android.gms@233717044@23.37.17 (190400-570218080):1) at com.google.android.chimera.ContentProvider.query(:com.google.android.gms@233717044@23.37.17 (190400-570218080):1) at mgp.query(:com.google.android.gms@233717044@23.37.17 (190400-570218080):2) at android.content.ContentProvider$Transport.query(ContentProvider.java:281) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:107) at android.os.Binder.execTransactInternal(Binder.java:1226) at android.os.Binder.execTransact(Binder.java:1163) # via Binder call with stack: at android.os.StrictMode.readAndHandleBinderCallViolations(StrictMode.java:2497) at android.os.Parcel.readExceptionCode(Parcel.java:2417) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:139) at android.content.ContentProviderProxy.query(ContentProviderNative.java:481) at android.content.ContentProviderClient.query(ContentProviderClient.java:196) at android.content.ContentProviderClient.query(ContentProviderClient.java:178) at bau.a(PG:30) at bkd.a(PG:1) at aqp.run(PG:27) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:344) at qco.run(PG:4) at qah.run(PG:3) at java.lang.Thread.run(Thread.java:1012) at qdi.run(PG:5) 

this is the error which i get while running the command flutter build apk --release

* What went wrong: A problem occurred configuring project ':google_mobile_ads'. > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.    > Namespace not specified. Please specify a namespace in the module's build.gradle file like so:      android {          namespace 'com.example.namespace'      } 

but i have it in my gradle file . i am giving here my app level build.gradle file

plugins {     id "com.android.application"     id "kotlin-android"     id "dev.flutter.flutter-gradle-plugin" } def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) {     localPropertiesFile.withReader('UTF-8') { reader ->         localProperties.load(reader)     } } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) {     flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) {     flutterVersionName = '1.0' } android {     namespace "com.example.tripp"     compileSdkVersion = 33     ndkVersion flutter.ndkVersion     compileOptions {         sourceCompatibility JavaVersion.VERSION_1_8         targetCompatibility JavaVersion.VERSION_1_8     }     kotlinOptions {         jvmTarget = '1.8'     }     sourceSets {         main.java.srcDirs += 'src/main/kotlin'     }     defaultConfig {         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).         applicationId "com.busdekho.tripp"         // You can update the following values to match your application needs.         // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.         minSdkVersion 33         targetSdkVersion flutter.targetSdkVersion         versionCode flutterVersionCode.toInteger()         versionName flutterVersionName                  buildFeatures {         buildConfig = true         }     }     buildTypes {         release {             // TODO: Add your own signing config for the release build.             // Signing with the debug keys for now, so `flutter run --release` works.             signingConfig signingConfigs.debug         }     } } flutter {     source '../..' } dependencies {     implementation 'com.google.android.gms:play-services-ads:22.3.0' } 

the below one is my project level gradle file which have small additions

buildscript {     ext.kotlin_version = '1.7.10'     repositories {         google()         mavenCentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:8.0.0'         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"     } } allprojects {     repositories {         google()         mavenCentral()     } } rootProject.buildDir = '../build' subprojects {     project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects {     project.evaluationDependsOn(':app') } tasks.register("clean", Delete) {     delete rootProject.buildDir } 

can any one help me in solving this problem . i am also giving you the complete error code that i am get in cmd

PS C:\Users\hp\Desktop\myprojects\tripp> flutter build apk --release FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':google_mobile_ads'. > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.    > Namespace not specified. Please specify a namespace in the module's build.gradle file like so: android {          namespace 'com.example.namespace'      } If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 2s Running Gradle task 'assembleRelease'...                            3.3s Gradle task assembleRelease failed with exit code 1 PS C:\Users\hp\Desktop\myprojects\tripp> 

AdRequest adRequest = new AdRequest.Builder()                 .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)                 .build();         adView.loadAd(adRequest); 
ads:adSize="BANNER" 

ads code is errorring

This is the Code But .addTestDevice is erroring how can ı add addTestDevice This is the code thanks

I have removed --> implementation 'com.google.android.gms:play-services-ads-identifier:11.4.0' dependency from build.gradle and also excluded it from all other dependencies present in project, but still getting com.google.android.gms:play-services-ads-identifier:17.0.0@aar in external libraries of project. I want to remove this sdk permanently but I am not able to do so, please provide me some solution for this.

As shown in the image admob banner ad is cut off or stretched.

If I use AdSize.banner widget does not take the entire width but shows the ad correctly. If I use full-banner the ad is stretched.

How do I get the banner to fit the full width of the screen and show the content correctly (without cut off or streached)?

class _AdBannerState extends State<AdBanner>{   BannerAd? _inlineAdaptiveAd;   bool _isLoaded = false;   AdSize? _finalSize;   @override   void didChangeDependencies() {     super.didChangeDependencies();     _loadAd();   }   void _loadAd() async {     await _inlineAdaptiveAd?.dispose();     setState(() {       _inlineAdaptiveAd = null;       _isLoaded = false;     });     // Get an inline adaptive size for the current orientation.     AdSize size = AdSize.fullBanner;     _inlineAdaptiveAd = BannerAd(       adUnitId: AdHelper.bannerAdUnitId,       size: size,       request: const AdRequest(),       listener: BannerAdListener(         onAdLoaded: (Ad ad) async {           debugPrint('Inline adaptive banner loaded: ${ad.responseInfo}');           // After the ad is loaded, get the platform ad size and use it to           // update the height of the container. This is necessary because the           // height can change after the ad is loaded.           BannerAd bannerAd = (ad as BannerAd);           _finalSize = await bannerAd.getPlatformAdSize();           // if (size == null) {           //   debugPrint(           //       'Error: getPlatformAdSize() returned null for $bannerAd');           //   return;           // }           setState(() {             _inlineAdaptiveAd = bannerAd;             _isLoaded = true;           });         },         onAdFailedToLoad: (Ad ad, LoadAdError error) {           debugPrint('Inline adaptive banner failedToLoad: $error');           ad.dispose();         },       ),     );     await _inlineAdaptiveAd!.load();   }   @override   Widget build(BuildContext context) {     return (_inlineAdaptiveAd != null && _isLoaded && _finalSize != null)         ? Expanded(             child: SizedBox(                 width: _finalSize!.width.toDouble(),                 height: _finalSize!.height.toDouble(),                 child: AdWidget(                   ad: _inlineAdaptiveAd!,                 )))         : const SizedBox(             width: 0,             height: 0,           );   }   @override   void dispose() {     _inlineAdaptiveAd?.dispose();     super.dispose();   } }