pikaju / flutter-braintree

Flutter plugin that wraps the native Braintree SDKs. Enables payments with credit cards, PayPal, Google Pay and more.
https://pub.dev/packages/flutter_braintree
MIT License
64 stars 115 forks source link

overwrites android:label to SECURE_CHECKOUT #118

Closed claudius-kienle closed 1 year ago

claudius-kienle commented 2 years ago

I just started to use your package and it works flawlessly.

Nevertheless, I experienced that the application name of the android application now changed to "SECURE CHECKOUT". I think it is because my AndroidManifest.xml defines the android:label="@string/app_name" and maybe the package also defines a app_name variable which then overwrites mine.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.flutter_braintree_example">
    <application
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher">
...
</manifest>

I correctly defined the app_name string in the build.grade:

I then tried to change andorid:label to a hard-coded string

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.flutter_braintree_example">
    <application
        android:label="Test"
        android:icon="@mipmap/ic_launcher">
...
</manifest>

but then I get following error:

Launching lib/main.dart on Android SDK built for x86 in debug mode...
lib/main.dart:1
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
flutter-braintree/example/android/app/src/debug/AndroidManifest.xml:10:5-25 Error:
    Attribute application@label value=(Test) from AndroidManifest.xml:10:5-25
    is also present at [org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.4-1] AndroidManifest.xml:15:9-41 value=(@string/app_name).
    Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:9:5-46:19 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Attribute application@label value=(Test) from AndroidManifest.xml:10:5-25
    is also present at [org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.4-1] AndroidManifest.xml:15:9-41 value=(@string/app_name).
    Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:9:5-46:19 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited

Following Repository contains the application that results in the above error: https://github.com/claudius-kienle/flutter-braintree

kamami commented 2 years ago

Same issue

Babwenbiber commented 2 years ago

add tools:replace="android:label" + android:label='myappname' to your AndroidManifest.xml in <application ... and if not already defined, define the tools namespace in your manifest <manifest ... xmlns:tools="http://schemas.android.com/tools" ...

claudius-kienle commented 2 years ago

But this would just allow to overwrite the defined android:label with the one defined in the package. The app name then always will be SECURE CHECKOUT

Therefore, this is not a solution.

Babwenbiber commented 2 years ago

I edited my answer. you need to add android:label='myappname' to your <application as well

claudius-kienle commented 1 year ago

Yeah, that worked! Thank you.