isar / isar

Extremely fast, easy to use, and fully async NoSQL database for Flutter
https://isar.dev
Apache License 2.0
3.55k stars 328 forks source link

master channel ,Android cannot build #1647

Open xiaohucode opened 2 months ago

xiaohucode commented 2 months ago

master channel ,Android cannot build isar v3

 Flutter (Channel master, 3.23.0-14.0.pre.156, on Ubuntu 22.04.3 LTS 5.15.153.1-microsoft-standard-WSL2, locale
    C.UTF-8)
    • Flutter version 3.23.0-14.0.pre.156 on channel master at /home/xiaohucode/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7f2fffd0b9 (9 hours ago), 2024-07-06 19:40:37 -0400
    • Engine revision 5ca3b856ee
    • Dart version 3.5.0 (build 3.5.0-323.0.dev)
    • DevTools version 2.37.0

error :


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':isar_flutter_libs:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/home/xiaohucode/yida/build/isar_flutter_libs/intermediates/merged_res/release/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.

* 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
realth000 commented 1 month ago

Occurs in v4 version after upgrade flutter to 3.24.

Roll flutter back to 3.22 may solve it.

With latest flutter 3.24, update the compileSdkVersion in isar_flutter_libs to 31 like the commit here will fix this, too:

Additionally, change it's dependency and your app's dependency.

Also the built android libs should be saved in android/src/main/jniLibs.

Or use my fork:

diff --git a/pubspec.yaml b/pubspec.yaml
index be9c6c1..45979f8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -47,7 +47,11 @@ dependencies:
       url: https://github.com/realth000/infinite-carousel-flutter
       ref: 11742d44ddec450b324b49b22e2196438b4ebfe1
   isar: ^4.0.0-dev.14
-  isar_flutter_libs: ^4.0.0-dev.14
+  isar_flutter_libs:
+    git:
+      url: https://github.com/realth000/isar/
+      ref: 98a6cc1236498ce79a9096f772da754df838da0c
+      path: packages/isar_flutter_libs
   json_annotation: ^4.9.0
   material_design_icons_flutter: ^7.0.7296
   path: any
7ANV1R commented 1 month ago

need immediate fix 🚧

SalhabNoman commented 1 month ago

Occurs in v4 version after upgrade flutter to 3.24.

Roll flutter back to 3.22 may solve it.

With latest flutter 3.24, update the compileSdkVersion in isar_flutter_libs to 31 like the commit here will fix this, too:

Additionally, change it's dependency and your app's dependency.

Also the built android libs should be saved in android/src/main/jniLibs.

Or use my fork:

diff --git a/pubspec.yaml b/pubspec.yaml
index be9c6c1..45979f8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -47,7 +47,11 @@ dependencies:
       url: https://github.com/realth000/infinite-carousel-flutter
       ref: 11742d44ddec450b324b49b22e2196438b4ebfe1
   isar: ^4.0.0-dev.14
-  isar_flutter_libs: ^4.0.0-dev.14
+  isar_flutter_libs:
+    git:
+      url: https://github.com/realth000/isar/
+      ref: 98a6cc1236498ce79a9096f772da754df838da0c
+      path: packages/isar_flutter_libs
   json_annotation: ^4.9.0
   material_design_icons_flutter: ^7.0.7296
   path: any

This solution worked for me on Flutter: 3.24, Gradle:7.6.3 and Isar: 3.1.0+1. Thank you very much.

7ANV1R commented 1 month ago

There is a fix i found in isar's Telegram chat by @Zchandev add to android/builld.gradele:

subprojects {
    //  fix for verifyReleaseResources
    // ============
   afterEvaluate { project ->
        if (project.plugins.hasPlugin("com.android.application") ||
                project.plugins.hasPlugin("com.android.library")) {
            project.android {
                compileSdkVersion 34
                buildToolsVersion "34.0.0"
            }
        }
    }
    // ============
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
mbfakourii commented 4 weeks ago

cc @simc

alextran1502 commented 4 weeks ago

Thanks @7ANV1R

mubashardev commented 1 week ago

There is a fix i found in isar's Telegram chat by @Zchandev add to android/builld.gradele:

subprojects {
    //  fix for verifyReleaseResources
    // ============
   afterEvaluate { project ->
        if (project.plugins.hasPlugin("com.android.application") ||
                project.plugins.hasPlugin("com.android.library")) {
            project.android {
                compileSdkVersion 34
                buildToolsVersion "34.0.0"
            }
        }
    }
    // ============
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

After applying your provided solution, I am getting this:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/mubasharhussain/Documents/.../android/build.gradle' line: 23

* What went wrong:
A problem occurred evaluating root project 'android'.
> Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.

* 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
Musta-Pollo commented 1 week ago

Occurs in v4 version after upgrade flutter to 3.24.

Roll flutter back to 3.22 may solve it.

With latest flutter 3.24, update the compileSdkVersion in isar_flutter_libs to 31 like the commit here will fix this, too:

Additionally, change it's dependency and your app's dependency.

Also the built android libs should be saved in android/src/main/jniLibs.

Or use my fork:

diff --git a/pubspec.yaml b/pubspec.yaml
index be9c6c1..45979f8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -47,7 +47,11 @@ dependencies:
       url: https://github.com/realth000/infinite-carousel-flutter
       ref: 11742d44ddec450b324b49b22e2196438b4ebfe1
   isar: ^4.0.0-dev.14
-  isar_flutter_libs: ^4.0.0-dev.14
+  isar_flutter_libs:
+    git:
+      url: https://github.com/realth000/isar/
+      ref: 98a6cc1236498ce79a9096f772da754df838da0c
+      path: packages/isar_flutter_libs
   json_annotation: ^4.9.0
   material_design_icons_flutter: ^7.0.7296
   path: any

This worked for me for Android but failed for iOS This works better for me: https://github.com/isar/isar/issues/1647#issuecomment-2287751997