GithubHelp home page GithubHelp logo

operando / advertising_id Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 34.0 366 KB

A Flutter plugin to access advertising ID.

License: Apache License 2.0

Kotlin 24.33% Ruby 23.87% Swift 21.29% Objective-C 6.18% Dart 23.59% Makefile 0.74%
advertising dart flutter flutter-plugin

advertising_id's People

Contributors

bernardo-cloudwalk avatar fachrifaul avatar hamzabouzekri67 avatar jocelyngriselle avatar kikuchy avatar miyakeryo avatar operando avatar phamconganh avatar wrbl606 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

advertising_id's Issues

Plugin not working. Is it even undermaintaince?

I have installed the package into a separate repository. And as soon I pressed the button to call the function await AdvertisingId.id(true); I'm getting below error:

MissingPluginException(No implementation found for method getAdvertisingId on channel advertising_id)

Flutter - v2.5.1

maybe a bug: `isLimitAdTrackingEnabled` has different meaning for android and iOS

Hi, thank you for providing this useful tool!

I may found a bug for our api:

AdvertisingId.isLimitAdTrackingEnabled: https://pub.dev/documentation/advertising_id/latest/advertising_id/AdvertisingId/isLimitAdTrackingEnabled.html

isLimitAdTrackingEnabled means whether ad track is disabled(limited), here is the explaination: https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info#isLimitAdTrackingEnabled()

From what I see, the implementation for iOS explain isLimitAdTrackingEnabled as whether ad track is enable:
https://github.com/operando/advertising_id/blob/master/ios/Classes/SwiftAdvertisingIdPlugin.swift#L41-L45

So i guessisLimitAdTrackingEnabled have different meaing for android and iOS:

  • android: ad track disabled
  • iOS: ad track enabled

I guess iOS implementation is not correct. What do you thing about this?

Thank you!

Builds are falling on Android

@operando This is not working bro! We are using v2.1.1 of this package. We tried updating the Kotlin v1.5.31. But it is just not working. Here is the error. Kindly look into this please, we have a sword on our heads by the Marketing team (not kidding).

We tried all possible combinations to get rid of this error. Updated the Gradle version to 4.2.2, updated the distributionUrl version to 6.9-all. But literally, nothing is working.

Console Error

ERROR:: R8: com.android.tools.r8.errors.b: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete

* 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 1m 29s
Running Gradle task 'bundleRelease'...                             90.3s
[!] The shrinker may have failed to optimize the Java bytecode.
    To disable the shrinker, pass the `--no-shrink` flag to this command.
    To learn more, see: https://developer.android.com/studio/build/shrink-code
Gradle task bundleRelease failed with exit code 1

Flutter Doctor

$ flutter doctor -v
[√] Flutter (Channel stable, 2.5.1, on Microsoft Windows [Version 10.0.22000.434], locale en-IN)
    • Flutter version 2.5.1 at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (4 months ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\Yash\AppData\Local\Android\Sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = C:\Users\Yash\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.63.2)
    • VS Code at C:\Users\Yash\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.32.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.71
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 97.0.1072.62

• No issues found!

Plugin called in background mode crashing on Android

Hello and thank you for your plugin!

I'm having an issue when calling AdvertisingId.id(true) on Android when running in the background. It leads to the late variable activity being not initialized thus crashing with kotlin.UninitializedPropertyAccessException error.

I wonder if you would accept a Merge Request dealing with this ? I was thinking of something like below :

if (activity.isInitialized) {
     val id = AdvertisingIdClient.getAdvertisingIdInfo(activity).id
     activity.runOnUiThread {
           result.success(id)
      }
 }
 else {
      result.error("", "Activity not initialized", null)
 }

What do you think ?
Best regards

java.lang.NullPointerException

Hi, I'm getting a considerable amount of exceptions related to this plugin in the crash reports.

Here's the stack trace:

java.lang.NullPointerException: 
  at com.os.operando.advertisingid.AdvertisingIdPlugin$onMethodCall$1.invoke (AdvertisingIdPlugin.java:30)
  at com.os.operando.advertisingid.AdvertisingIdPlugin$onMethodCall$1.invoke (AdvertisingIdPlugin.java:11)
  at kotlin.concurrent.ThreadsKt$thread$thread$1.run (ThreadsKt.java:30)

What could be happening?

Build Broken

After updating to 2.1.0 the flutter build appbundle crashes with following logs (only for android):

[        ] > Task :advertising_id:compileReleaseAidl NO-SOURCE
[        ] > Task :advertising_id:compileReleaseRenderscript NO-SOURCE
[        ] > Task :advertising_id:generateReleaseBuildConfig UP-TO-DATE
[        ] > Task :advertising_id:generateReleaseResValues UP-TO-DATE
[        ] > Task :advertising_id:generateReleaseResources UP-TO-DATE
[        ] > Task :advertising_id:packageReleaseResources UP-TO-DATE
[        ] > Task :advertising_id:parseReleaseLocalResources UP-TO-DATE
[        ] > Task :advertising_id:processReleaseManifest UP-TO-DATE
[  +92 ms] > Task :advertising_id:generateReleaseRFile UP-TO-DATE
[ +604 ms] > Task :advertising_id:compileReleaseKotlin FAILED
[        ] e: Incompatible classes were found in dependencies. Remove them from the classpath or use
'-Xskip-metadata-version-check' to suppress errors
[   +2 ms] e:
/Users/USERNAME/.gradle/caches/transforms-3/38a7fea0325bf765d81c8dc3c120c305/transformed/jetified-kotlin-
stdlib-jdk7-1.5.31.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] e:
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible
version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
[        ] e:
/Users/USERNAME/.gradle/caches/transforms-3/fb601dcdc6c034b07b15c8ea122906d5/transformed/jetified-kotlin-
stdlib-common-1.5.31.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (14, 26): Unresolved reference: thread
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (20, 10): Class 'kotlin.jvm.JvmStatic' was compiled with
an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/jvm/JvmStatic.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (24, 20): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (25, 21): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (31, 17): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (38, 9): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (51, 9): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (52, 35): Unresolved reference: thread
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (55, 30): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (56, 32): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (59, 30): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (60, 32): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (60, 40): Unresolved reference: javaClass
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (64, 43): Unresolved reference: thread
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (67, 30): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (68, 32): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (71, 30): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (72, 32): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[        ] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (72, 40): Unresolved reference: javaClass
[        ] e:
/Users/USERNAME/.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/android/src/main/kotlin/com/os/op
erando/advertisingid/AdvertisingIdPlugin.kt: (76, 28): Class 'kotlin.Unit' was compiled with an
incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is
1.1.15.
[   +2 ms] The class is loaded from
/Users/USERNAME/.gradle/caches/transforms-3/6c87f3acbf13b40ac5e88ec17ade8676/transformed/jetified-kotlin-
stdlib-1.5.31.jar!/kotlin/Unit.class
[        ] FAILURE: Build failed with an exception.
[        ] * What went wrong:
[        ] Execution failed for task ':advertising_id:compileReleaseKotlin'.
[        ] > Compilation error. See log for more details
[        ] * 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 1m 0s
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle
8.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See
https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 46 actionable tasks: 4 executed, 42 up-to-date
[ +405 ms] Running Gradle task 'bundleRelease'... (completed in 61,7s)
[   +3 ms] "flutter appbundle" took 63.350ms.
[   +3 ms] Gradle task bundleRelease failed with exit code 1
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      AndroidGradleBuilder.buildGradleApp
(package:flutter_tools/src/android/gradle.dart:383:9)
           <asynchronous suspension>
           #2      AndroidGradleBuilder.buildAab
(package:flutter_tools/src/android/gradle.dart:196:5)
           <asynchronous suspension>
           #3      BuildAppBundleCommand.runCommand
           (package:flutter_tools/src/commands/build_appbundle.dart:148:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand
           (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure>
(package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:92:3)
           <asynchronous suspension>
           
           
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[   +1 ms] exiting with code 1

Facing issue while generating iOS build

Please check I am not able create to iOS build after adding this plugin .
.pub-cache/hosted/pub.dartlang.org/advertising_id-2.1.0/ios/Classes/AdvertisingIdPlugin.m:2:9: 'advertising_id/advertising_id-Swift.h' file not found

Error during compile

Trying this plugin for the first time. Ran into an error I don't understand, and googling it doesn't reveal much.

D:\dev\purified\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:18: error: constructor AdvertisingIdPlugin in class AdvertisingIdPlugin cannot be applied to given types;
    flutterEngine.getPlugins().add(new com.os.operando.advertisingid.AdvertisingIdPlugin());
                                   ^
  required: Registrar
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error

coding invoking it

try {
      advertisingId = await AdvertisingId.id(true);
    } on PlatformException {
      advertisingId = 'Failed to get platform version.';
    }

thoughts?

Error building on iOS

I am seeing the same error as reported in #4 (comment) and #21.

I noticed that if I clone the repo and reference the path, it works fine, but installing it normally doesn't work. The difference I see is that in the cloned version's AdvertisingIdPlugin.m I have:

#if __has_include(<advertising_id/advertising_id-Swift.h>)
#import <advertising_id/advertising_id-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "advertising_id-Swift.h"
#endif

However, in the downloaded version I have:

#import <advertising_id/advertising_id-Swift.h>

without the if-else import block.

Other plugins using the same import strategy work fine, but the if-else import block is still in the downloaded plugin.

iOS Xcode build fails because module advertising_id can't be found

GeneratedPluginRegistrant.m has issues with the line
@import advertising_id;
stating 'Module advertising_id not found'

I simply added it to the pubscpec, run flutter clean and flutter pub get multiple times.
I also reinstalled the pods, in case that matters. xCode refused to build with this error.
No errors on the android side (tested and working).

Any ideas on what the issue may be?

Unable to `flutter run -d all`

Today is my first day with Flutter. I got the "Hello World" app to work on both the virtual iPhone Xs and Pixel 3 after running a basic flutter create advertising_id_demo.

I then followed the installation instructions for this package. After adding advertising_id: ^0.9.1 as a dependency to the project's pubspec.yaml file and running flutter pub get, the "Hello World" app fails to build with the following error / stack trace:

$ flutter run -d all
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling
software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                              0.8s
Resolving dependencies...                                           1.2s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        10.1s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                         2.6s
Launching lib/main.dart on iPhone Xs in debug mode...
Running pod install...                                              0.7s
CocoaPods' output:

      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
    -> Fetching podspec for `advertising_id` from `.symlinks/plugins/advertising_id/ios`

    Resolving dependencies of `Podfile`

    Comparing resolved specification to the sandbox manifest
      A Flutter
      A advertising_id

    Downloading dependencies

    -> Installing Flutter (1.0.0)

    -> Installing advertising_id (0.0.1)
      - Running pre install hooks
    [!] Unable to determine Swift version for the following pods:

    - `advertising_id` does not specify a Swift version and none of the targets (`Runner`) integrating it have the
    `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of
    the targets that integrate this pod.

    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/lib/cocoapods/installer/xcode/target_
    validator.rb:122:in `verify_swift_pods_swift_version'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/lib/cocoapods/installer/xcode/target_
    validator.rb:37:in `validate!'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/lib/cocoapods/installer.rb:578:in
    `validate_targets'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/lib/cocoapods/installer.rb:158:in
    `install!'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/lib/cocoapods/command/install.rb:51:i
    n `run'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/lib/cocoapods/command.rb:52:in `run'
    /Users/ilya/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.7.4/bin/pod:55:in `<top (required)>'
    /Users/ilya/.rbenv/versions/2.2.3/bin/pod:23:in `load'
    /Users/ilya/.rbenv/versions/2.2.3/bin/pod:23:in `<main>'

I've created a demo repo that you can clone to help with debugging:
https://github.com/ilyakam/advertising_id_demo

Here's some info about my setup:

  • macOS version 10.14.5
  • Xcode version 10.2.1
  • Android Studio version 3.4
  • Flutter version 1.7.8+hotfix.2
  • Cocoapods version 1.7.4
  • Simulator version 10.2.1 running iPhone Xs on iOS 12.2
  • Emulator running Pixel 3 on Android 9.0 (API 28 x86)

Could you please help? It's possible that I'm doing something wrong, I just don't know what.

[Android][AGP 8.4] R8 removes all classes in aar.

Hello,

I spent several days understanding why my application was crashing in release mode. I had this trace

Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/os/operando/advertisingid/AdvertisingIdPlugin;
                                                                                                        at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:24)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                        at io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister.registerGeneratedPlugins(GeneratedPluginRegister.java:80) 
                                                                                                        at io.flutter.embedding.android.FlutterFragmentActivity.configureFlutterEngine(FlutterFragmentActivity.java:743) 
                                                                                                        at 

From what I see this error comes from the fact that R8, despite the Proguard rules placed at the application level, removes classes from the aar.

Indeed, the build.gradle of this lib specifies that minifyEnabled true without providing keep rules. And, because since AGP 8.4 library classes are shrunk : all classes are removed (this is an intended behaviour).
See : https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes#library-classes-shrunk
And / or : https://issuetracker.google.com/issues/353738489

Could you, either

  • remove minifyEnabled true.
  • set up keep rules to ensure functions/classes are kept for consumers (app).

Thanks.

Workaround that works for me :

placed in app build.gradle level

subprojects { subproject ->
    afterEvaluate {
        final isAndroidAppPlugin = subproject.plugins.hasPlugin('android')
        final isAndroidLibraryPlugin = subproject.plugins.hasPlugin('android-library')
        final isAndroidPlugin = isAndroidAppPlugin || isAndroidLibraryPlugin
        if (isAndroidPlugin) {
            android {
                if (isAndroidLibraryPlugin) {
                    final releaseBuildType = subproject.android.buildTypes["release"]
                    if (releaseBuildType.consumerProguardFiles.empty) {
                        buildTypes {
                            release {
                                minifyEnabled false
                                // disable minification for this lib, at aar level. Note that the global minification of the app WILL be applied.
                            }
                        }
                    }
                }

            }
        }
    }
}

[IOS] - Install steps

Thanks for your plugin !

Just in case anyone fails to get the plugin to work on iOS, make sure you update Info.plist file located in ios/Runner directory and add the NSUserTrackingUsageDescription key with a custom message describing your usage

<key>NSUserTrackingUsageDescription</key>
<string>Request tracking...</string>

If your app calls the App Tracking Transparency API, you must provide custom text, known as a usage-description string, which displays as a system-permission alert request.

I can open a PR to update the README with some basic install steps :)

Execution failed for task :advertising_id:generateDebugRFile

Package version 2.6.0. Kotlin 1.9.22, flutter 3.19.0

Gradle distributionUrl=https://services.gradle.org/distributions/gradle-7.6.3-all.zip

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':advertising_id:generateDebugRFile'.
> A failure occurred while executing com.android.build.gradle.internal.res.GenerateLibraryRFileTask$GenerateLibRFileRunnable
   > /Users/dmitry/.gradle/caches/transforms-3/07d0e826a195cc80e3a8dd91497835a2/transformed/com.google.android.gms.ads_identifier-r.txt

Remove references to deprecated v1 Android embedding

Remove references to deprecated v1 Android embedding

To ensure this plugin will work with users running the next stable version of Flutter remove references to the v1 embedding.

The v1 embedding was deprecated around 6 and a half years ago. In Flutter 3.22, the Flutter tool dropped support for building v1 apps entirely. Flutter plans to delete version one of it's Android embedding in the next stable release, per https://medium.com/flutter/whats-new-in-flutter-3-22-fbde6c164fe3 (in the "Removal of v1 Android embedding" section).

When that deletion happens, any apps using plugins that still have references to the removed classes will fail to build when updating to the next stable version (probably Flutter 3.26).

As a part of this deprecation, the Flutter Android team is doing community outreach by filing bugs and submitting some pull requests to update plugins to minimize the impact this removal has on the community.

Some example PRs:

Consequences:

  • This change should have no impact on users of this plugin that are building apps using the v2 embedding (we don't have a percentage to share, but this is the vast majority of users).
  • It will remove support for users that are still using the v1 embedding on versions of Flutter older than 3.22.

If this change doesn't land, this plugin will instead be broken for all apps building on the next stable version of Flutter and beyond.

Is there a way to support both v1 and v2 embedding apps in the next stable version of Flutter?

No.

This is the PR where we are removing the deprecated engine classes: flutter/engine#52022

missing readme information about NSUserTrackingUsageDescription for iOS

For iOS you will need to add the following key with a String value that is your reason for tracking to your info.plist file. otherwise the app will crash once you try to access the ad id.

<key>NSUserTrackingUsageDescription</key>
    <string>your reason</string>

this information should be in the readme.

Can't build, too old kotlin

I am getting gradle error due to too old kotlin in advertising_id 'The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'advertising_id' is using version 1.2.31.'

Can't install after upgrade to Flutter 3.3.x

When running pod install, I am now getting the following error:

[!] CocoaPods could not find compatible versions for pod "Flutter":
  In Podfile:
    Flutter (from `Flutter`)

    advertising_id (from `.symlinks/plugins/advertising_id/ios`) was resolved to 0.0.1, which depends on
      Flutter

Specs satisfying the `Flutter (from `Flutter`), Flutter` dependency were found, but they required a higher minimum deployment target.

I have tried pod install, pod update, pod install --repo-update`, to only get the same error.

My flutter doctor:

[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-x64, locale en-CA)
    • Flutter version 3.3.4 on channel stable at /Users/guillaumeferron/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (13 days ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/guillaumeferron/Library/Android/sdk
    • Platform android-33, build-tools 30.0.2
    • Java binary at: /Users/guillaumeferron/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/guillaumeferron/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
    • IntelliJ at /Users/guillaumeferron/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 70.2.5
    • Dart plugin version 222.4345.14

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
    • IntelliJ at /Users/guillaumeferron/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.72.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (3 available)
    • iPhone 14 Pro Max (mobile) • 15A88CC8-3F1F-407A-AB31-06B489D99129 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0
      (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 106.0.5249.61

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

This is an urgent issue as this makes the upgrade impossible.

ArgumentError Closure: ([bool]) => Future<String?>

Hi,

I'm getting this error when trying to fetch Advertising Id using your class by calling AdvertisingId.id.

ArgumentError (Invalid argument: Closure: ([bool]) => Future<String?> from Function 'id': static.)

This is my setup:

Flutter 2.10.3 • channel unknown • unknown source
Framework • revision 7e9793dee1 (4 months ago) • 2022-03-02 11:23:12 -0600
Engine • revision bd539267b4
Tools • Dart 2.16.1 • DevTools 2.9.2

Build fails on compilation process.

Hi. Issue from 2.2.0 package's version. After update Kotlin to 1.6.10 gotcha this error (pasted down here). Gradle version is 7.1.1.
flutter clean, and repeated flutter pub get don't work. Tried to downgrade Kotlin and package version, but it's not work at all.
Cleaning Cache from user/AppData/Local/pub and flutter/bin not working too.

Also, try to build apk from example, same story.

e: C:\Users\Ashere\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\advertising_id-2.2.0\android\src\main\kotlin\com\os\operando\advertisingid\AdvertisingIdPlugin.kt: (24, 31): **Type mismatch: inferred type is Activity? but Activity was expected**

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':advertising_id:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* 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 6s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Issue screen

Kotlin version

Can you please upgrade kotlin version to latest? Receiving this warning

\jetified-kotlin-stdlib-common-1.3.72.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.