Flutter Image Cropper Android Manifest Error - "com.yalantis.ucrop.UCropActivity, was not found in the project or the libraries" - flutter

I am getting the error "Class referenced in the manifest, com.yalantis.ucrop.UCropActivity, was not found in the project or the libraries " when I add an activity to my Android Manifest file. Here is the code which is causing the error:
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"/>
I am trying to install the image_cropper package, and in the installation guide it requires that I add this activity statement to the Android Manifest file. I am using MacOS
What I have tried:
I have followed the note in the installation guide "From v1.2.0, you need to migrate your android project to v2 embedding (detail)"
I ran pub get when I added to my pubspec.yaml
I ran flutter doctor and I have no warnings
Cleaned my flutter project and restarted Android Studio

you have to add the two activities in the android manifest that will help you edit the loaded image, the path is android android/app/src/main and add.
<activity android:name="com.android.camera.CropImage"/>
<activity android:name="com.yalantis.ucrop.UCropActivity"/>

I had the same problem and realized I made the silliest mistake. I merged an old project into a new one, and my manifest file was in the wrong place.
Make sure it's in android/app/src/main

I added these lines to /android/app/build.gradle file
android{
//...
lintOptions {
abortOnError false
}
}
and it worked for me.
ref: AndroidManifest class referenced applicationName was not found

Related

flutter pubspec.yaml deleted after updating

Hello experts I am facing very big issue I am made application in 2021 on flutter my application is still live on play store now I need update it, problem is that I updated my android studio flutter version 3.0. Now opening my old project which was made in 2021 after opening it my pubspec.yaml file is missing in the project, I don't no how to recover that file or repair it. They have a lot of dependencies included there is pubspec.lock file available but not pubspec.yaml please please help me i am in big check screen shot below
if i use flutter create command i am getting this errors
You can create a pubspec.yaml file on root directory or open the bottom terminal and try flutter create . it will provide default structure. Now to get pub package, check the import section and add on pubspec.yaml
If you have a backup then paste the pubspec.yaml file from it. Else take a backup of the project. Run flutter create . in the root directory. It will create the pubspec file in the project. Click on configure dart and add the flutter path then run the project. It will throw errors for the packages used manually enter packages in pubspec or you can try flutter pub add <packagename>

How can I solve the version of the Android embedding?

I have this problem. Plz let me know how to solve this problem..
I got this git code from a lesson made about 2years ago.
Also different errors showed up when I made a flutter project using git code.
-> This is the problem
This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
If you are here because of the flutter 2.10, do this:
Change this:
<application
android:icon="#mipmap/ic_launcher"
android:name="io.flutter.app.FlutterApplication"
android:label="PassesBox"
...
To this:
<application
android:icon="#mipmap/ic_launcher"
android:name="${applicationName}"
android:label="PassesBox"
...
If the application is very old, you should consult the migration guide that the documentation or fial offers you, just like the other answers recommend.
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
but if you still have the deprecated application warnning try the following
step one: delete the cache. flutter clean
step two: remove the pubspec.lock file from the root of the project. rm pubspec.lock
step three: update the libraries if you have any very outdated, you can do it manually or through the command. flutter pub upgrade --major-versions (this command will update all the libraries you have, be careful, before evaluating if such an update is necessary in your project).
then you must make some changes at the android folder level
change the gradle.zip in android/gradle/wrapper/gradle-wrapper.properties to a newer version like:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
and in android/build.gradle update the version to
classpath 'com.android.tools.build:gradle:7.1.2'
the kotlin version in : ext.kotlin_version = '1.6.10'
and if you were using code obfuscation with proguard-rules.pro
remove any added configurations that reference that file in android/app/build.gradle and you should be left with just this
buildTypes {
release {
signingConfig signingConfigs.release
}
}
finally close the code editor or the IDE you use
and in console run flutter pub get and run your project flutter run
Last but not least, do not forget to update the build version of your application to API 33 or higher and have your android studio updated (VERY IMPORTANT FOR UPDATE, )
android-studio
This has been answered before here on SO.
Here:
Your Flutter application is created using an older version of the Android embedding
And here: How to Fix Flutter Warning: Your Flutter application is created using an older version
You can also look at the source of how to migrate here:
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

ionic base64togallery plugin not working in android-targetSdkVersion 29

I'm using base64-to-gallery to save images for android devices in my ionic app.
Previously it was working fine but now after added <preference name="android-targetSdkVersion" value="29" />to config.xml file, under android platform, it's not working.
Please kindly help me with it.
Finally solved the issue. To anyone who is struggling, I will explain as below.
As mentioned in the git, https://github.com/Nexxa/cordova-base64-to-gallery , ionic Cordova base64togallery plugin has been discontinued.
And also when trying to submit the ionic mobile app for Android production, it's saying that the target SDK version should be more than 29.
But as usual, if we add <preference name="android-targetSdkVersion" value="29" /> to the config.xml file under the Android platform, it will not work the base64togallery plugin (not saving images to your device)
So you have to do like below,
In your ionic project, go to build.gradle file (platforms\android\build.gradle) and change defaultTargetSdkVersion and defaultCompileSdkVersion to 29. (as below)
defaultTargetSdkVersion=29
defaultCompileSdkVersion=29
And then go to AndroidManifest.xml file
(platforms\android\app\src\main\AndroidManifest.xml) and add android:requestLegacyExternalStorage="true" to the application tag, as showing below.
<application android:hardwareAccelerated="true" android:icon="#mipmap/ic_launcher" android:label="#string/app_name" android:networkSecurityConfig="#xml/network_security_config" android:requestLegacyExternalStorage="true" android:supportsRtl="true">
Then try to build your app for debug or release versions.

Flutter build release apk with no sound null safety?

Debug apk works fine, release apk not working..
Tried flutter build apk --no-sound-null-safety it builds release apk but does not works.
Issue Solved!!
Actually, the problem was with 'http' as SSL certificate was not included for the admin panel hence, app showed
Bad state: Insecure HTTP is not allowed by platform error in some devices while it was running in my Mi note4 mobile phone.
Added
android:usesCleartextTraffic="true" line in
AndroidManifest.xml file inside
<manifest <application android:usesCleartextTraffic="true""> </application> </manifest> tag
The ability to mix language versions frees package maintainers to migrate their code, with the knowledge that even legacy users can get new bug fixes and other improvements. However, mixed-version programs don’t get all the advantages that null safety can bring. Read here
Solution
Code for building APK:
flutter build apk --no-sound-null-safety

Problem after generating released apk file in flutter

I generated the released apk file in flutter using android studio. But after generating the file it was installed in real time mobile but not working. It shows host name error in the console. How to resolve this error?
Make sure you added
< uses-permission android:name="android.permission.INTERNET"/>
to your Manifest.xml file android/app/src/main, because flutter do this only for development version
under