Flutter: Native Ads Error: Cannot find symbol - flutter

I'm trying to set up Admob Native ads on Flutter following the official documentation, however for my surprise, nothing seems to work because I keep getting the same error:
Copy (12-error)\android\app\src\main\java\com\app\appname\adFactoryExample.java:47: error: cannot find symbol
adView.setIconView(adView.findViewById(R.id.ad_app_icon));
This issue seems common so obviously, I tried the popular solutions including "flutter clean", changing the "android/app/build.gradle" file to 31 and add: android.useAndroidX=true android.enableJetifier=true to the "gradle.properties" file.
But nothing worked and I'm still having the same frustrating problem!

Seems that this error is related with the NativeAdFactory file (eg: ListTileNativeAdFactory.java) and the layout at app/src/main/res/layout/list_title_native_ad.xml
This is how I fix it: I went to the Google Codelabs example at https://github.com/googlecodelabs/admob-inline-ads-in-flutter/tree/main/complete and copied those files exactly like the example. That solved the issue.

Related

java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient,

I can't run app on emulator/ real device.when i try to run app from vscode. it shows this error message. screenshot of debug console
i uninstall app and flutter clean.
UPDATE:
This error just happened to me when I launched the app in the store. I'm correcting it now, change the Location library to Gelocator.
At first I thought it was an error in Flutter 3.7.0, I lowered the version to 3.3.10 and 3.3.9 and the same problem continued. My solution was to change the location library to geolocator. It has almost the same functions, I only had to make a few changes.
https://pub.dev/packages/geolocator
No need to change the package I was also facing this issue I just fixed it:
Go into C:\Users\Qc\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\location-4.4.0\android\build.gradle :
changed "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" works
dependencies {
api '"com.google.android.gms:play-services-location:21.0.1'
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
List item In project at android level go into build.gradle and add this line:
in my case, got to C:\Users\Md Emarat Hossain\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\location-4.4.0\android\build.gradle and changed "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" works
I changed from "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" in my project this PATH
"C:\Users\chint\flutter.pub-cache\hosted\pub.dartlang.org\geolocator_android-4.1.7\android\build.gradle"

When running the App, I get the error: Cannot find 'webviewController' in scope

I have searched the internet but cannot find others with the same problem. Does any one know how to fix the below error?
After updated XCode to version 14.0, my Flutter app failed to build. I have found out that the problematic package is html_editor_enhanced. If I remove it, then the build is successful, but I need it for allowing WYSIWYG editor. I see that it depends on another package called flutter_inappwebview, so I added it, but to no avail. When I try to build, the error in VSCode is:
Swift Compiler Error (Xcode): Cannot find 'webviewController' in scope /Users/<username>/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/InAppWebView/FlutterWebViewFactory.swift:32:8 2
Swift Compiler Error (Xcode): Cannot find 'webviewController' in scope /Users/<username>/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/InAppWebView/FlutterWebViewFactory.swift:33:15
And in XCode, the error is:
Cannot find 'webviewController' in scope
Below is the screenshot from XCode.
running the following command fixed the problem:
flutter pub cache repair

Flutter: MissingPluginException(No implementation found for method printPdf on channel net.nfet.printing)

guys!
I am developing a desktop POS application for a shop. The application should have a feature to print some docs and barcodes. I have used pdf package to generate pdfs, but I am having a trouble with installing and using the priting package on Windows.
The main problem is with isntallation. In the docs, it says you should add the following lines in
CMakeLists.txt
file:
...
set(PDFIUM_VERSION "4929" CACHE STRING "" FORCE)
set(PDFIUM_ARCH "x64" CACHE STRING "" FORCE)
...
I am very confused in which CMakeLists.txt I shall put, because flutter's windows folder includes multiple files with the same name and extension. (windows\CMakeLists.txt, windows\runner\CMakeLists.txt, windows\flutter\CMakeLists.txt)
I have put the same piece of code into these different files, but none of them worked.
It always gives some errors like below:
errors
The thing I wanted to accomplish is to just print a generated PDF:
code
I'm having the same issue
What I do is
Flutter clean
Flutter pub get
Uninstall the previous application
Run the app again
And it worked
go to your terminal and type the following commands.
Flutter clean
Flutter pub get
now close the app
build the app again
hope this works for you. thanks.

Flutter Windows: cannot build App error MSB8066

I am getting this error while building for windows
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238,5): error MSB8066: Custom build for 'D:\DSI projects\sanjali_app\build\windows\CMakeFiles\a6c8cc86bdf940a07f4885a881770ba0\flutter_windows.dll.rule;D:\DSI projects\sanjali_app\build\windows\CMakeFiles\9c479cc21d461e620769ab96f5bca778\flutter_assemble.rule' exited with code 1. [D:\DSI projects\sanjali_app\build\windows\flutter\flutter_assemble.vcxproj]
Exception: Build process failed.
Updated Aug 2021
Faced the same error for couple of hours, and none of the issue on Github or answer on StackOverflow seems to be working for me.
So after my research I found out that there is no specific reason why Error MSB8066 error occur, but it can be due to space in your project Folder path as mentioned by #aishamhasan or some other undetermined reason. In my case, there is a simple file that is missing.
Error detected in pubspec.yaml:
[ +2 ms] [ ] No file or variants found for asset: images/project_app.png.
In order to quickly find out what causing this problem, you can run your project from the command line instead of using run functionality on android studio.
flutter run -d windows -v
And inside your verbose, lookout for any error, or you can directly search for Error and then try to figure out what was causing the error.
Followed the same approach and I was able to resolve the error very quickly.
Sometimes I get this error too. I have found that it happens whenever I forget to add a final slash "/" when declaring an assets folder in pubspec.yaml. For example:
This will produce the error:
flutter:
assets:
- assets/
- assets/game_logos
Adding the final slash solves the error:
flutter:
assets:
- assets/
- assets/game_logos/
The solution that worked for me is that I deleted build folder/dir from my project
In my case I had an assets image that I removed from the folder but had the path in pubspec.yaml, so I deleted the path then the app could run in Windows.
Removing spaces on the Projects Folder Path Solves the Issue.
Flutter Issues
I got MSB8066 when I generate python bindings, and fixed this by disabling
BUILD_PYTHON_BINDINGS in CMakeLists.txt
This can happen for a few reasons, an asset's path is missing the slash:
So:
assets:
assets/image
While it should be like this:
assets:
assets/image/
With the slash at the end.
The other more normal one, and which could really be causing such an error, could be the following;
The directory your project is in contains a special character, for example:
C:\Users\Aurélio Fernam\Documents\Projets\my_project
As you can see, "Aurélio" contains a special character. This could be causing this error.
Also try not to have a folder with space in your project path, like this:
C:\Users\Aurélio Fernam\Documents\Projets\my_project
Notice that "Aurélio Fernando/" besides having a special character, contains a space.
This could also be a trigger.
After having moved the project to a better directory, run flutter clean and run the project normally.
I faced the same issue due to some errors were there in some of the dart files. Check for red-underlined errors in the dart files you may have missed. These errors don't allow the project to run. After resolving the errors the project is running fine.
Non-Alphanumeric Characters in the project name also cause it.
I played arround with json in my asset folder. I deleted it and missed to remove it from pubspec as well.
Deleting the build folder in my project fixed the issue for me, you can also run a flutter clean, then run your project again.
In my case I use:
flutter pub get
None of the above methods worked for me.
First, I get an export zip file from project. And extract its content.
And open it, instead of the main project.
Only this worked for me after 1 day. But don't know why!
UPDATE:
This error fix for me when run Android Studio as administrator.

Nativescript RadSideDrawer gives symbol not available at run time error

I am following nativescript RadSideDrawer doc at:
http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/SideDrawer/getting-started, but once I started the app in ios emulator, I am getting this error:
CONSOLE ERROR file:///app/tns_modules/#angular/core/./bundles/core.umd.js:1052:24: ERROR Error: Uncaught (in promise): ReferenceError: Metadata for "TelerikUI.TKSideDrawerView" found but symbol not available at runtime.
RadSideDrawer#file:///app/tns_modules/nativescript-telerik-ui/sidedrawer/sidedrawer.js:15:38
I tried several times and always got the same error.
What's wrong with this? Is the documentation having errors here?
Thanks
It looks like there may be inconsistency and incompatibility in the used dependencies in your package.json. You can take a look at the sdkAngular repository that showcases many scenarios for using the RadSideDrawer and the other components of the nativescript-telerik-ui-pro plugin here.
Other things that you can try is to clean the project, by deleting the platforms and node_modules folders and running tns run ios after that.