Dev-Devarsh / flutter_encryption_decryptions

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Strange Android build error #1

Open longtimedeveloper opened 8 months ago

longtimedeveloper commented 8 months ago

If I run the example app, it builds and works perfect.

When I add the package to my project and try to build it, I get the below error.

I am no expert, but the two bold lines suggest the problem.

I have never seen this type of build error after adding a package dependency.

I did try adding, 'tools:replace="android:label"' and 'tools:replace="android:allowBackup"' but then got a different build error.

Any suggestions? Thank you!

'''

D:\code\spravzhni\spravzhni_mobile\android\app\src\debug\AndroidManifest.xml Error: Attribute application@allowBackup value=(false) from (unknown) is also present at [com.github.tgio:rncryptor-native:0.0.9] AndroidManifest.xml:14:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:4:5-36:19 to override. D:\code\spravzhni\spravzhni_mobile\android\app\src\debug\AndroidManifest.xml Error: Attribute application@label value=(????????) from (unknown) is also present at [com.github.tgio:rncryptor-native:0.0.9] AndroidManifest.xml:15:9-41 value=(@string/app_name). Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:4:5-36:19 to override.

FAILURE: Build failed with an exception.

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

Dev-Devarsh commented 8 months ago

Thank you so much @longtimedeveloper for your response i will fix it soon so you can continue you work

longtimedeveloper commented 8 months ago

@Dev-Devarsh this is my AndroidManifest.xml I hope this can help. Thank you very much

AndroidManifest.xml ```console ```
Dev-Devarsh commented 8 months ago

I appreciate you providing more details, @longtimedeveloper.

Dev-Devarsh commented 8 months ago

Hey @longtimedeveloper Inside your android >app > src > main > AndroidManifest.xml file , add below lines tools:replace="android:label" inside your application tag & add xmlns:tools="http://schemas.android.com/tools" to your manifest tag

All set , You are ready to secure app with encryption

longtimedeveloper commented 8 months ago

@Dev-Devarsh still will not build.

Debug console build errors ```console D:\code\spravzhni\spravzhni_mobile\android\app\src\debug\AndroidManifest.xml Error: Attribute application@allowBackup value=(false) from (unknown) is also present at [com.github.tgio:rncryptor-native:0.0.9] AndroidManifest.xml:14:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:4:5-37:19 to override. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > Manifest merger failed : Attribute application@allowBackup value=(false) from (unknown) is also present at [com.github.tgio:rncryptor-native:0.0.9] AndroidManifest.xml:14:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:4:5-37: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 1m 52s Exception: Gradle task assembleDebug failed with exit code 1 ```
longtimedeveloper commented 8 months ago

@Dev-Devarsh

AndroidManifest.xml ```console ```
longtimedeveloper commented 8 months ago

Hey @longtimedeveloper Inside your android >app > src > main > AndroidManifest.xml file , add below lines tools:replace="android:label" inside your application tag & add xmlns:tools="http://schemas.android.com/tools" to your manifest tag

All set , You are ready to secure app with encryption

this fix didn't work. You can see my build errors and my new AndroidManifest.xml above. Thank you for trying.

longtimedeveloper commented 8 months ago

@Dev-Devarsh are you going to reopen this issue? Or should I try to find another package? I really like this package. Thank you.

Dev-Devarsh commented 8 months ago

Hey @longtimedeveloper

just pase this code in your AndroidManifest XML file , make sure your are replacing code in release AndroidManifest XML file not in debug AndroidManifest XML file

<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:fullBackupContent="true"    
        android:label="СПРАВЖНІ"
        android:name="${applicationName}"
        tools:replace="android:label" 
        android:icon="@mipmap/launcher_icon">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
longtimedeveloper commented 8 months ago

This is a very secure app. I can not use the below two settings.

 android:allowBackup="true"
 android:fullBackupContent="true"    

Your configuration of AndroidManifest XML results in the same errors I have been getting.

Dev-Devarsh commented 8 months ago

Every one can use without any kind of updatation in manifest file I dont know what's wrong with your code Please provide me full error message along with gradle version & kotlin version you are using

Dev-Devarsh commented 8 months ago

And if you dont want to use this package, simply copy the code from MainActivity.kt from this packages android folder and use it with Method channel in your project