SaltechSystems / couchbase_lite

Flutter plugin for the Community edition of Couchbase Lite. Couchbase Lite is an embedded lightweight, document-oriented (NoSQL), syncable database engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to install

MilesHart opened this issue · comments

Describe the bug
Unable to install couchbase_lite

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Flutter App
  2. Add couchbase_lite by adding couchbase_lite: ^2.7.1 to the pubspec.yaml, get pub
  3. Debug

Expected behavior
It builds and deploys

Screenshots
C:\dev\FlutterCouch101\fluttercouch101\android\app\src\debug\AndroidManifest.xml:4:9-40 Error:
Attribute application@label value=(fluttercouch101) from AndroidManifest.xml:4:9-40
is also present at [com.couchbase.lite:couchbase-lite-android:2.8.1] AndroidManifest.xml:33:18-50 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:3:4-40: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=(fluttercouch101) from AndroidManifest.xml:4:9-40
is also present at [com.couchbase.lite:couchbase-lite-android:2.8.1] AndroidManifest.xml:33:18-50 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:3:4-40: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 10s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Desktop (please complete the following information):

  • OS: Windows 10 pro
  • Browser chrome
  • Version 90.0.4430.93 (Official Build) (64-bit)

Smartphone (please complete the following information):

  • Device: flutter emulator Android 11
  • OS: Android
  • Browser
  • Version

The fix is already in the error message: a minor issue in AndroidManifest.xml

add 'tools:replace="android:label"'

<application
        android:name="io.flutter.app.FlutterApplication"
        ...
        tools:replace="android:label">
        <activity
            android:name=".MainActivity"
            ...
        </activity>
</application>

@function1983 your suggestion helped, but it gave another error....

`Execution failed for task ':app:generateDebugBuildConfig'.

Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'.
Failed to query the value of property 'packageName'.
> org.xml.sax.SAXParseException; systemId: file:/C:/Users/ruip/StudioProjects/cdb_with_flutter/android/app/src/main/AndroidManifest.xml; lineNumber: 6; columnNumber: 38; The prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound.

  • 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.`

After some more searching, I found the solution in https://stackoverflow.com/questions/32002361/how-to-fix-android-manifest-xml-naming-conflict/32033581...

Basically making this addition to

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yourpackage" xmlns:tools="http://schemas.android.com/tools">