Overriding Library twice in android studio project manifest - android

Min sdkversion of my project is 8.I am using two libraries whose min version is 9 and 10.When I run my project it showed two errors that uses-sdk:minSdkVersion 8 cannot be smaller than version 10 declared in library Suggestion: use tools:overrideLibrary="com.brightcove.seamless" to force usage for one.When I did this it asked the same for other library.But since we can use tools:overrideLibrary once I dont know how to overcome this...please help...

Pre-Required:
Add Your library inside gradle with compile scope
In Side AndroidMenifest.xml file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xx.tech.cs.xx" >
And then above application start tag need to add
<uses-sdk tools:overrideLibrary="com.brightcove.seamless"/>
No need to change the minSDK version of your applications so it will go through with this I hope you can work this code in your program.
I have same issue for the other minSDK=14 version library and my application minSDK is 10 So I use this way.

Related

Building MAUI Android Failing

I created a brand new MAUI app (I had to create a new app as the previous app I'd created with a preview version didn't work when I upgraded Visual Studio preview). This app is using prism.maui which shouldn't make any difference and I'm also using a class library built with the preview version.
My app runs fine with Windows so I have no concern that I have issues with the app. I have also cleared out the obj folder multiple times with no joy.
When I build Android I get the following error message:
Error AMM0000
uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\lp\164\jl\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="androidx.security" to force usage (may lead to runtime failures)
Money.App D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\AndroidManifest.xml 35
I know how to fix this - but even when I do I get a further issue:
AMM0000
Attribute application#appComponentFactory value=(androidx.core.app.CoreComponentFactory) from AndroidManifest.xml:24:18-86
is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:11:3-33:17 to override.
Money.App D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\AndroidManifest.xml 24
I really don't know where to go from here. I've recreated this app now 3 times and if this is how it needs to work for MAUI I need to go back to using Xamarin.
Please help!
I had the same error after I added a package name via the properties of the project.
As a consequence of adding the package name via the options of the project, the AndroidManifest.xml package attribute was updated, wich is what is expected, but there was also a tag that was being added, wich was unwanted.
The tag was the following:
<uses-sdk />
After removing this tag everything worked again.
Go to androidManifest.xml file
add: uses-sdk android:minSdkVersion="21" if not exist
otherwise update uses-sdk section to uses-sdk android:minSdkVersion="21"
That solves my problem

Flutter "Add 2 App" Android integration with adjustments to generated .android

I'm working on an Android app with 3+ years of Kotlin development and want to gradually migrate it to Flutter feature-by-feature. I use option B of the "add 2 app" integration where I depend on the module's source code. Features written Flutter are integrated into the native Android app with FlutterActivity or FlutterFragment. This worked great for the first feature however now I have an issue with migrating the second feature. The second feature requires the packages camera and firebase_ml_vision. Now the problem is that camera requires a min SDK of 21 but the generated Android code in .android sets the min SDK to 16. Additionally firebase_ml_vision requires initialization of Firebase which also needs to be added to .android. I'm thinking about adding .android to VCS and add the required changes however this is generated code. It gets removed when flutter clean is called and generated on flutter pub get. I would have to constantly adjust the generated code when Flutter changes/removes it :( .android only hosts the "skeleton" Android app which is started when the Flutter project is run from IDE (or command line). It is not the host app (the old, native app) where Firebase is already configured. However the .android app is used for quick development cycles. If I cannot use this anymore because of said limitations, I would always have to start the native Android app (host) and lose many benefits of Flutter like hot reload :( Has anyone come across the same problem?
Update:
In this article they clearly state that .android should not be modified or added to VCS. They even mention the camera module as an example. However this does not work and can be reproduced with a few simple steps:
Create a new module: flutter create --template=module --project-name example
cd example
Add camera plugin to pubspec.yaml
flutter pub get
Now running flutter build apk results in the following error:
/Users/sven/Development/example/.android/app/src/main/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] /Users/sven/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+11/android/build/intermediates/library_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] /Users/sven/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+11/android/build/intermediates/library_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)
I noticed you are facing 2 issues/ questions:
Minimum android sdk compatibility mismatch: Probably requires some work by the flutter team for a proper fix (I expected the flutter_module/build.gradle to be more useful, but it wasn't (not the one in build/ or .android), but as a workaround, some :app module AndroidManifest.xml changes using uses-sdk will work:
<manifest ...>
<uses-sdk android:targetSdkVersion="29" android:minSdkVersion="21"
tools:overrideLibrary="com.example.flutter_module, com.example.flutter_module.host"/>
...
</manifest>
(I set the default package name for the flutter module but you should replace both instances of com.example.flutter_module with your package name. (check your build.gradles). What I do here is raise the minSDK for the 2 flutter modules that were added. The error message you got recommended lowering the minSDK for camera to 16, but this is not a good idea (the camera plugin developers set it to 21 probably because the APIs they use have minSDK 21, e.g. camera2).
How to setup firebase/ dependencies config in build.gradle? (i.e. firebase_ml_vision and firebase 'platform specific configuration'): Change your main app's app/build.gradle and AndroidManifest.xml as per the instructions. This is what the doc says:
Perform those Android Gradle file edits on your outer, existing Android app rather than in your Flutter module.
Let me know if you need anymore help :)
on android/app/build.gradle changing minSdkVersion to 21

Google Play Services : target=android-19 in project.properties

I am utilizing the library BaseGameUtils and google-play-services_lib. In the project.properties file I could see the below mentioned line .
target=android-19.
What is the significance of this? Can I change this to "target=android-21". This is just to be in sync with the App's manifest file
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
Yes. You can change this, Depending target only, packages load for you in eclipse.
What is the significance of target=android-19?
target = android-X in project properties file means that Eclipse will not allow use methods or classes from SDK higher than X. It will show compiler errors.
How to change target:
Right click your project.
Then click "Properties".
Then select "Android" from the tree on the left.
You can then select the target version on the right.
NOTE: Before doing this make sure your project.properties and classpath are not in read-only mode otherwise it won't work. Also don't try to edit this file manually.
As a general rule I use the following guidelines
android:minSdkVersion="8"
Set this to the minimum level you want to support. Check which Android version that it actually relates to and make sure that you have compatibility with that version. For example, I think 8 = Android 2.2, which could be a problem if you are using google play services libraries. It is good practice to at least test that you app will work properly on this version using the emulator, because otherwise you will get a lot of errors and bad reviews.
android:targetSdkVersion="21" />
I usually set this to the maximum version that I have actually tested my app on. I thin 21 is Android 4.4, so you should be making sure that your app works correctly on this version of Android. At the least, you should test that it will run in an emulator that is configured with this version of Android.
Hope this helps.

How to combine two projects made under different API level?

I m creating a customised music player with some additional features in it.... for that i copied one project whose API level is 10 and pasted it in my current working project whose API level is 19..... i m getting an error "Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 10"...... I don't know how to make two API level work in the same project ..... please help....... i tried cleaning my project and rebuilding it ..... but after that it shows R cannot be resolved to a variable
Try changing the api level on the project, in your project manifest you will find this line:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
Change the targetSdkVersion to 19 to make it work with Android 4.4.

Android. How correct to set Build Target for application and Min SDK version?

I want to use in my application classes from API Level 11. Which in this case I define value of Build Target?
How are related Build Target of application and the minimum version of SDK?
I would be very grateful for the help!
Build Target is used to choose the android.jar of the platform version which will be used to compile the code.
minSdkVersion is defined in the manifest file and used by Android Market to filter out apps, it has nothing to do with the compile time or runtime behaviour
You can set the minimum sdk value of your project inthe Android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tfe.rma.ciss.be"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
</manifest>
and if you want to specify a specific emulator or phone which will compile the code (in this case, the build target you are asking about) , go to
right click on your project
choose, click on properties
choose Android
choose the api of the emulator
Greetings !
NB: Bear in mind that your built target must have a greater or at least the same value than your minSDK version

Categories

Resources