Posts tagged with java

I am using google-ads-java library to fetch campaigns from my Google Ads account follow this Google Ads API tutorial.
Everything is smooth with my ads.properties setting (clientId, clientSecret, refreshToken, developerToken, loginCustomerId)

But when it runs, it doesn't output anything then after a while, it shows an error:

c.g.ads.googleads.lib.request.summary    : FAILURE REQUEST SUMMARY. Method: google.ads.googleads.v15.services.GoogleAdsService/SearchStream, Endpoint: googleads.googleapis.com:443, CustomerID: {my_ad_manager_id}, RequestID: null, ResponseCode: UNAVAILABLE, Fault: Connection closed after GOAWAY. HTTP/2 error code: NO_ERROR, debug data: session_timed_out. c.g.ads.googleads.lib.request.detail     : FAILURE REQUEST DETAIL. Request ------- MethodName: google.ads.googleads.v15.services.GoogleAdsService/SearchStream Endpoint: googleads.googleapis.com:443 Headers: {developer-token=REDACTED, login-customer-id={my_ad_manager_id}, x-goog-api-client=gl-java/19.0.2 gccl/28.0.0 gapic/28.0.0 gax/2.32.0 grpc/1.56.1} Body: customer_id: "{my_ad_account_id}" query: "SELECT campaign.id, campaign.name FROM campaign ORDER BY campaign.id" Response -------- Headers: null Body: null Failure message: null Status: Status{code=UNAVAILABLE, description=Connection closed after GOAWAY. HTTP/2 error code: NO_ERROR, debug data: session_timed_out, cause=null}. 

No further info at my local.
When I check the Google Cloud APIs & Services Dashboard, it shows all the requests got 403 error

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

How can I integrate my WhatsApp for business (not using any 3rd party tools like Pabbly, WANotifier, etc.) to send a pdf document (Purchase Order details) to the customers without having to send a welcome text message and the customer not having to reply back with anything to receive the pdf document (Purchase Order details)?.

Note: if this is not possible then how does MakeMyTrip and book my show works where in which when we book tickets or shows we receive a pdf file (booking details) without we in person initiating the conversation of asking the booking details.

Went through the official MetaforDevelopers document https://developers.facebook.com/docs/whatsapp/cloud-api but couldn't find any solutions.

If somebody finds something out of the document link attached above related to my requirement, please let me know! Thanks in advance!

I'm trying to put advertisements on my app, I put my app on amazon app store and then approved by google admob I set up Ad Unit ID (next level promotion) and put in both the xml and java part the appropriate code for it to work however I still don't get any Ad bar on the home of my app. Does anyone have any idea why it doesn't come up?

Java:

   ` MobileAds.initialize(this, initializationStatus -> {});     // Create an AdView and set the ad unit ID and ad size     adView = new AdView(this);     adView.setAdUnitId("*******");      adView.setAdSize(AdSize.BANNER);     // Add the AdView to your layout     LinearLayout adContainer = findViewById(R.id.ad_container);     if (adContainer != null) {         adContainer.addView(adView);         // Load an ad         AdRequest adRequest = new AdRequest.Builder().build();         adView.loadAd(adRequest);     }` 

XML:

       `<com.google.android.gms.ads.AdView         android:id="@+id/ad_container"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignParentBottom="true"         app:adSize="BANNER"         app:adUnitId="***" />`