Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException: Unsupported value: 'com.cleveradssolutions.internal.content.zf' #10

Closed
wszak opened this issue May 18, 2024 · 11 comments · Fixed by #13
Closed

Comments

@wszak
Copy link

wszak commented May 18, 2024

1st issue:
With a banner being displayed I'm getting following errors:

E/CAS.AI (17030): Callback: 6: java.lang.IllegalArgumentException
E/CAS.AI (17030): java.lang.IllegalArgumentException: Unsupported value: 'com.cleveradssolutions.internal.content.zf@68155a7' of type 'class com.cleveradssolutions.internal.content.zf'
E/CAS.AI (17030): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:297)
E/CAS.AI (17030): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:285)
E/CAS.AI (17030): at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:61)
E/CAS.AI (17030): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation.success(EventChannel.java:251)
E/CAS.AI (17030): at com.cleveradssolutions.plugin.flutter.bannerview.BannerViewEventListener.onAdViewPresented(BannerViewEventListener.kt:22)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zb.onAdRevenuePaid(SourceFile:3)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zg.zb(SourceFile:7)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zg.zb(SourceFile:6)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zg.run(SourceFile:2)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.zn.zb(SourceFile:1)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.zn.zc(SourceFile:2)
E/CAS.AI (17030): at com.cleveradssolutions.sdk.base.CASHandler.main(SourceFile:1)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zg.zb(SourceFile:4)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zc.ze(SourceFile:16)
E/CAS.AI (17030): at com.cleveradssolutions.internal.content.zb.zb(SourceFile:30)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.ze.zc(SourceFile:13)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.ze.access$applyNewAdContent(SourceFile:22)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.zd.run(SourceFile:12)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.zn.zb(SourceFile:1)
E/CAS.AI (17030): at com.cleveradssolutions.internal.impl.zn.dispatchMessage(SourceFile:3)
E/CAS.AI (17030): at android.os.Looper.loopOnce(Looper.java:226)
E/CAS.AI (17030): at android.os.Looper.loop(Looper.java:313)
E/CAS.AI (17030): at android.app.ActivityThread.main(ActivityThread.java:8663)
E/CAS.AI (17030): at java.lang.reflect.Method.invoke(Native Method)
E/CAS.AI (17030): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
E/CAS.AI (17030): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
94
E/FrameEvents(17030): updateAcquireFence: Did not find frame.

This exception is thrown every a couple of seconds.
The "updateAcquireFence: Did not find frame." might be also somehow related as it doesn't happen without CAS.

2nd issue:
I had to switch to SDK version 23 because I was getting error:
"UnsupportedOperationException
Platform views cannot be displayed below API level 23 You can prevent this issue by setting minSdkVersion: 23 in build.gradle."
Right now you seem to require SDK 21. The error was occuring on some older Android (5.1 IIRC).

Flutter 3.19.6, CAS 3.7.2, Cas-Flutter 0.3.0

@Jedures
Copy link
Member

Jedures commented May 20, 2024

Hello, can you tell me which kind of implementation banner ads you use?

@Jedures
Copy link
Member

Jedures commented May 20, 2024

And can you show your code how you do it?

@Str4tos
Copy link
Member

Str4tos commented May 20, 2024

Hi @wszak, thank you for raising the issue.

2nd issue:
I had to switch to SDK version 23 because I was getting error:
"UnsupportedOperationException
Platform views cannot be displayed below API level 23 You can prevent this issue by setting minSdkVersion: 23 in build.gradle."
Right now you seem to require SDK 21. The error was occuring on some older Android (5.1 IIRC).

The issue you mentioned arose due to the Flutter update. Please find out more about it in the issue flutter/flutter#147210

@wszak
Copy link
Author

wszak commented May 20, 2024

And can you show your code how you do it?

  LayoutBuilder(
    builder: (context, constraints) {
      return SafeArea(
        child: Scaffold(
          body: Column(
            children: <Widget>[
              BannerView(size: AdSize.Banner),
              ...

@Jedures
Copy link
Member

Jedures commented May 20, 2024

Can you make an example project reproducing this error and send it to us? It will help us to fix this issue

@wszak
Copy link
Author

wszak commented May 20, 2024

Can you make an example project reproducing this error and send it to us? It will help us to fix this issue

I'll try, but even when I take your example project and run it, then press Initialize I'm getting the following error:

I/CASIntegrationHelper(10049): --- Verifying Integration ---
I/CASIntegrationHelper(10049): Core version: 3.6.0
E/CAS.dart(10049): Initialize Unity Bridge failed
E/CAS.dart(10049): java.lang.NoSuchMethodError: No interface method initialize(Landroid/app/Activity;)Lcom/cleversolutions/ads/MediationManager; in class Lcom/cleversolutions/ads/android/CAS$ManagerBuilder; or its super classes (declaration of 'com.cleversolutions.ads.android.CAS$ManagerBuilder' appears in /data/app/~~PVeK6Nfnmz0JlzFhNpQscQ==/com.example.cas_sample-H4LesTg-3OoTHXPncn56vA==/base.apk!classes5.dex)
E/CAS.dart(10049): at com.cleveradssolutions.plugin.flutter.CASBridge.(CASBridge.java:43)
E/CAS.dart(10049): at com.cleveradssolutions.plugin.flutter.CASBridgeBuilder.buildInternal(CASBridgeBuilder.java:73)
E/CAS.dart(10049): at com.cleveradssolutions.plugin.flutter.CASBridgeBuilder.build(CASBridgeBuilder.java:53)
E/CAS.dart(10049): at com.cleveradssolutions.plugin.flutter.CASFlutter.build(CASFlutter.kt:337)
E/CAS.dart(10049): at com.cleveradssolutions.plugin.flutter.CASFlutter.onMethodCall(CASFlutter.kt:72)
E/CAS.dart(10049): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/CAS.dart(10049): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/CAS.dart(10049): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/CAS.dart(10049): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/CAS.dart(10049): at android.os.Handler.handleCallback(Handler.java:938)
E/CAS.dart(10049): at android.os.Handler.dispatchMessage(Handler.java:99)
E/CAS.dart(10049): at android.os.Looper.loopOnce(Looper.java:226)
E/CAS.dart(10049): at android.os.Looper.loop(Looper.java:313)
E/CAS.dart(10049): at android.app.ActivityThread.main(ActivityThread.java:8663)
E/CAS.dart(10049): at java.lang.reflect.Method.invoke(Native Method)
E/CAS.dart(10049): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
E/CAS.dart(10049): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/flutter (10049): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(CASFlutterBridgeError, failed to get CASBridgeBuilder, null, null)
E/flutter (10049): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter (10049): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
E/flutter (10049):
E/flutter (10049):
I/CASIntegrationHelper(10049): --- Mediation integration ---
W/CASIntegrationHelper(10049): > [ Mediation adapters ]: 12/13

I tried with Core version: 3.7.2 too.

Any idea why this might be happening? I remember running your test example successfully in the past.

Below is my Flutter doctor output:

[✓] Flutter (Channel stable, 3.19.6, on Manjaro Linux 5.15.158-1-MANJARO, locale en_US.UTF-8)
• Flutter version 3.19.6 on channel stable at /opt/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9, 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1

@Str4tos Str4tos changed the title two issues IllegalArgumentException: Unsupported value: 'com.cleveradssolutions.internal.content.zf' May 21, 2024
@Str4tos
Copy link
Member

Str4tos commented May 23, 2024

java.lang.NoSuchMethodError: No interface method initialize(Landroid/app/Activity;)Lcom/cleversolutions/ads/MediationManager; in class Lcom/cleversolutions/ads/android/CAS$ManagerBuilder; or its super classes

This issue has been fixed in CAS Core update 3.7.3. Please try updating the CAS core version.

@bugrevealingbme
Copy link

java.lang.NoSuchMethodError: No interface method initialize(Landroid/app/Activity;)Lcom/cleversolutions/ads/MediationManager; in class Lcom/cleversolutions/ads/android/CAS$ManagerBuilder; or its super classes

This issue has been fixed in CAS Core update 3.7.3. Please try updating the CAS core version.

how to update?

@wszak
Copy link
Author

wszak commented May 24, 2024

Now works with your original example, but still doesn't work with BannerView and latest clever_ads_solutions 0.3.0.

So, take your example and:

  • upgrade clever_ads_solutions to 0.3.0 in pubspec.yaml
  • upgrade build.gradle to use CAS 3.7.3
  • update main.dart with the code below

Press Initialize and then press "TEST ERROR".
I see exception:

E/CAS.AI  (10810): Callback: 6: java.lang.IllegalArgumentException
E/CAS.AI  (10810): java.lang.IllegalArgumentException: Unsupported value: 'com.cleveradssolutions.internal.content.zf@c0def67' of type 'class com.cleveradssolutions.internal.content.zf'
E/CAS.AI  (10810): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:297)
E/CAS.AI  (10810): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:285)
E/CAS.AI  (10810): 	at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:61)
E/CAS.AI  (10810): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation.success(EventChannel.java:251)
E/CAS.AI  (10810): 	at com.cleveradssolutions.plugin.flutter.bannerview.BannerViewEventListener.onAdViewPresented(BannerViewEventListener.kt:22)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zb.onAdRevenuePaid(SourceFile:3)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zg.zb(SourceFile:7)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zg.zb(SourceFile:6)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zg.run(SourceFile:2)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.zn.zb(SourceFile:1)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.zn.zc(SourceFile:2)
E/CAS.AI  (10810): 	at com.cleveradssolutions.sdk.base.CASHandler.main(SourceFile:1)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zg.zb(SourceFile:4)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zc.ze(SourceFile:16)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.content.zb.zb(SourceFile:30)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.ze.zc(SourceFile:13)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.ze.access$applyNewAdContent(SourceFile:22)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.zd.run(SourceFile:12)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.zn.zb(SourceFile:1)
E/CAS.AI  (10810): 	at com.cleveradssolutions.internal.impl.zn.dispatchMessage(SourceFile:3)
E/CAS.AI  (10810): 	at android.os.Looper.loopOnce(Looper.java:226)
E/CAS.AI  (10810): 	at android.os.Looper.loop(Looper.java:313)
E/CAS.AI  (10810): 	at android.app.ActivityThread.main(ActivityThread.java:8663)
E/CAS.AI  (10810): 	at java.lang.reflect.Method.invoke(Native Method)
E/CAS.AI  (10810): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
E/CAS.AI  (10810): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
V/CAS.AI  (10810): Banner(320, 50) Waterfall [LastPage_WithNet] Refresh loop resumed
168
E/FrameEvents(10810): updateAcquireFence: Did not find frame.

My main.dart:

import 'package:clever_ads_solutions/public/BannerView.dart';
import 'package:clever_ads_solutions/public/AdCallback.dart';
import 'package:clever_ads_solutions/public/AdImpression.dart';
import 'package:clever_ads_solutions/public/AdLoadCallback.dart';
import 'package:clever_ads_solutions/public/AdPosition.dart';
import 'package:clever_ads_solutions/public/AdSize.dart';
import 'package:clever_ads_solutions/public/AdType.dart';
import 'package:clever_ads_solutions/public/AdViewListener.dart';
import 'package:clever_ads_solutions/public/CASBannerView.dart';
import 'package:clever_ads_solutions/public/InitConfig.dart';
import 'package:clever_ads_solutions/public/InitializationListener.dart';
import 'package:clever_ads_solutions/public/ManagerBuilder.dart';
import 'package:clever_ads_solutions/public/MediationManager.dart';
import 'package:flutter/material.dart';
import 'package:clever_ads_solutions/CAS.dart';
import 'package:clever_ads_solutions/public/AdTypes.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  Widget? bannerWidget;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Clever Ads Solutions Example App'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              bannerWidget ?? CircularProgressIndicator(),

              ElevatedButton(
                child: Text('1. Inititalize'),
                onPressed: () => inititalize(),
              ),
              ElevatedButton(
                child: Text('2. TEST ERROR'),
                onPressed: () {
                  setState(() {
                    bannerWidget = BannerView(
                      size: AdSize.Banner,
                      isAutoloadEnabled: true,
                    );
                  });
                }
              ),
              ElevatedButton(
                child: Text('Show interstitial'),
                onPressed: () => showInterstitial(),
              ),
              ElevatedButton(
                child: Text('Show rewarded'),
                onPressed: () => showRewarded(),
              ),
              ElevatedButton(
                child: Text('Create standart banner'),
                onPressed: () => createStandartBanner(),
              ),
              ElevatedButton(
                child: Text('Create adaptive banner'),
                onPressed: () => createAdaptiveBanner(),
              ),
              ElevatedButton(
                child: Text('Change banner position to top'),
                onPressed: () => changeBannerTop(),
              ),
              ElevatedButton(
                child: Text('Change banner to bottom'),
                onPressed: () => changeBannerBottom(),
              ),
            ],
          ),
        ),
      ),
    );
  }

  MediationManager? manager;

  Future<void> inititalize() async {
    CAS.setDebugMode(true);

    CAS.setFlutterVersion("1.20.0");

    CAS.validateIntegration();

    ManagerBuilder builder = CAS
        .buildManager()
        .withTestMode(true)
        .withCasId("demo")
        .withAdTypes(AdTypeFlags.Banner |
            AdTypeFlags.Rewarded |
            AdTypeFlags.Interstitial)
        .withInitializationListener(InitializationListenerWrapper());

    manager = builder.initialize();
  }

  Future<void> showInterstitial() async {
    manager?.showInterstitial(InterstitialListenerWrapper());
  }

  Future<void> showRewarded() async {
    manager?.showRewarded(InterstitialListenerWrapper());
  }

  CASBannerView? view;
  Future<void> createAdaptiveBanner() async {
    view = manager?.getAdView(AdSize.Adaptive);
    view?.setAdListener(BannerListener());
    view?.setBannerPosition(AdPosition.TopCenter);
    view?.showBanner();
  }

  Future<void> createStandartBanner() async {
    view = manager?.getAdView(AdSize.Banner);
    view?.setAdListener(BannerListener());
    view?.showBanner();
  }

  void changeBannerTop() {
    view?.setBannerPosition(AdPosition.TopCenter);
  }

  void changeBannerBottom() {
    view?.setBannerPosition(AdPosition.BottomCenter);
  }
}

class InitializationListenerWrapper extends InitializationListener {
  @override
  void onCASInitialized(InitConfig initialConfig) {
    String error = initialConfig.error;
    String countryCode = initialConfig.countryCode;
    bool isTestMode = initialConfig.isTestMode;
    bool isConsentRequired = initialConfig.isConsentRequired;
  }
}

class InterstitialListenerWrapper extends AdCallback {
  @override
  void onClicked() {}

  @override
  void onClosed() {}

  @override
  void onComplete() {}

  @override
  void onImpression(AdImpression? adImpression) {}

  @override
  void onShowFailed(String? message) {}

  @override
  void onShown() {}
}

class BannerListener extends AdViewListener {
  @override
  void onAdViewPresented() {}

  @override
  void onClicked() {}

  @override
  void onFailed(String? message) {}

  @override
  void onImpression(AdImpression? adImpression) {}

  @override
  void onLoaded() {}
}

class LoadCallback extends AdLoadCallback {
  @override
  void onAdFailedToLoad(AdType adType, String? error) {}

  @override
  void onAdLoaded(AdType adType) {}
}

ps. You should also test it on Flutter 3.x, I see that your example still uses 2.x in pubspec.yaml.

@wszak
Copy link
Author

wszak commented Jun 21, 2024

Were you able to reproduce this error?

@kraativ
Copy link
Contributor

kraativ commented Jul 10, 2024

Fixed in version 0.4.0.

@kraativ kraativ linked a pull request Jul 10, 2024 that will close this issue
@kraativ kraativ closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants