tapsellorg / TapsellPlusSDK-FlutterPlugin

Other
6 stars 2 forks source link

🐛  باگ: #20

Closed sayedReza closed 1 year ago

sayedReza commented 1 year ago
**شرح باگ در پلاگین**:برنامه با نمایش باگ زیر اجرا نمیشود. توی قسمت خطاهای رایج درباره این مشکل نوشته بود که کد زیر رو به گریدل اضافه کنم و من هم انجام دادم ``` dependencies { def supportedAdmob = "20.6.0" implementation("com.google.android.gms:play-services-ads:$supportedAdmob") } ``` بعد از اون بازهم مشکل داشت و به این صفحه رفتم و چیزایی که گفته بود رو انجام دادم ولی بازهم حل نشد ``` https://developers.google.com/admob/android/quick-start?hl=fa#import_the_mobile_ads_sdk ``` توی همین صفحه گفته بود که باید اپ ای دی تهیه کنم و اینچیزا ! برای تپسل هم باید این کار ها رو انجام بدیم؟ **پیشنهاد**: من توی چندتا ( تقریبا 15 تا )گروه برنامه نویسی عضو هستم و ازشون درمورد پیاده سازی تپسل توی پروژه ها سوال کردم ولی کسی بلد نبود با اینکه خیلی ها میخواستن ازش استفاده کنند . لطفا یه آموزش تصویری کامل از افزودن تپسل به پروژه بسازید . نمیخواد خیلی تدوین و اینکارا روش انجام بدید فقط یه آموزش ساده هم باشه کافیه که این باگ های مشخص برای کسی پیش نیاد ممنون میشم. **متن کامل خطا یا لاگ مرتبط به طور کامل**: ``` Launching lib\main.dart on Redmi Note 8T in debug mode... Parameter format not correct - √ Built build\app\outputs\flutter-apk\app-debug.apk. E/AndroidRuntime(12516): FATAL EXCEPTION: main E/AndroidRuntime(12516): Process: ir.iranzamindevs.quit_smoking, PID: 12516 E/AndroidRuntime(12516): java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: E/AndroidRuntime(12516): E/AndroidRuntime(12516): ****************************************************************************** E/AndroidRuntime(12516): * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers * E/AndroidRuntime(12516): * should follow the instructions here: * E/AndroidRuntime(12516): * https://googlemobileadssdk.page.link/admob-android-update-manifest * E/AndroidRuntime(12516): * to add a valid App ID inside the AndroidManifest. * E/AndroidRuntime(12516): * Google Ad Manager publishers should follow instructions here: * E/AndroidRuntime(12516): * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. * E/AndroidRuntime(12516): ****************************************************************************** E/AndroidRuntime(12516): E/AndroidRuntime(12516): E/AndroidRuntime(12516): at android.app.ActivityThread.installProvider(ActivityThread.java:7633) E/AndroidRuntime(12516): at android.app.ActivityThread.installContentProviders(ActivityThread.java:7107) E/AndroidRuntime(12516): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6980) E/AndroidRuntime(12516): at android.app.ActivityThread.access$1600(ActivityThread.java:257) E/AndroidRuntime(12516): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1993) E/AndroidRuntime(12516): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(12516): at android.os.Looper.loop(Looper.java:236) E/AndroidRuntime(12516): at android.app.ActivityThread.main(ActivityThread.java:8057) E/AndroidRuntime(12516): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(12516): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) E/AndroidRuntime(12516): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) E/AndroidRuntime(12516): Caused by: java.lang.IllegalStateException: E/AndroidRuntime(12516): E/AndroidRuntime(12516): ****************************************************************************** E/AndroidRuntime(12516): * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers * E/AndroidRuntime(12516): * should follow the instructions here: * E/AndroidRuntime(12516): * https://googlemobileadssdk.page.link/admob-android-update-manifest * E/AndroidRuntime(12516): * to add a valid App ID inside the AndroidManifest. * E/AndroidRuntime(12516): * Google Ad Manager publishers should follow instructions here: * E/AndroidRuntime(12516): * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. * E/AndroidRuntime(12516): ****************************************************************************** E/AndroidRuntime(12516): E/AndroidRuntime(12516): E/AndroidRuntime(12516): at com.google.android.gms.ads.internal.client.zzek.attachInfo(com.google.android.gms:play-services-ads-lite@@22.2.0:26) E/AndroidRuntime(12516): at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@22.2.0:1) E/AndroidRuntime(12516): at android.app.ActivityThread.installProvider(ActivityThread.java:7628) E/AndroidRuntime(12516): ... 10 more ``` **پکیج نیم برنامه‌**: ``` ir.iranzamindevs.quit_smoking ``` **اطلاعات اضافی که به حل مشکل کمک می‌کنند**: _project build.gradle:_ ``` buildscript { ext.kotlin_version = '1.8.20' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir } ``` _app build.gradle:_ ``` def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { namespace "ir.iranzamindevs.quit_smoking" 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 "ir.iranzamindevs.quit_smoking" // 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 21 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } 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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.google.android.gms:play-services-ads:22.2.0' } ``` _android manifest:_ ``` ```
sayedReza commented 1 year ago

مرسی از راهنماییتون با قراردادن کد زیر در منیفست مشکل حل شد.

  <meta-data
           android:name="com.google.android.gms.ads.APPLICATION_ID"
           android:value="ca-app-pub-3940256099942544~3347511713"/>