Error Run App in Flutter

Jerry PM
3 min readJun 26, 2023

--

This error for adding new feature adMob

Source: Author

Error `namespace`

The first issue is because there is the use of the same name in line number 13 of the AndroidManifest.xml file. The error is similar to the one shown in the image above. If there are two instances of this android:name="???", then delete one of them. It is located in the application section, as shown in the example below.

Source: Author

Error in the package

Next, this is not a Gradle error. I mistakenly thought that this error was due to my Gradle not being updated or an error in Gradle in Android Studio. So initially, I updated the Android Studio version and also updated the Gradle version, but this error still appeared. After rereading the error, I finally found the problem, which is that the package I registered in the `pubspec.yaml` is causing the error, and the package that is causing the error is blue_thermal_printer. So for now, I will temporarily remove this package.

Source: Author

the solution that error above:

dependencies:
flutter:
sdk: flutter

carousel_slider: ^4.2.1
cupertino_icons: ^1.0.2
flutter_launcher_icons: ^0.11.0
http: ^0.13.5
shared_preferences: ^2.0.17 #<--For local save or load data
connectivity_plus: ^3.0.3 #<-- cek conection #<- not yet
auto_size_text: ^3.0.0
# blue_thermal_printer: ^1.2.3 #<-- for printer just android #<- not yet
get: ^4.6.5

Error when running in Simulator iOS

Next, there is an error when I run it on the iOS simulator with the error GADInvalidInitializationException. The reason is that I haven't registered the Google AdMob ID for iOS in the info.plist file, as it should be initialized with an application ID.

Source: Author

Add to Info.plist in this file

<flutter_project>/ios/Runner/Info.plist

<key>GADApplicationIdentifier</key>
<string>[ADMOB_APP_ID]</string>

After I fixed the two errors earlier, my app can now be run on iOS and Android. Here is the result. for the next article, I will show the results of the AdMob that has been running on both platforms.

.
Support here:
https://www.paypal.com/paypalme/jpm99

--

--

Responses (1)