(aab build) aapt_rules.pro not found

./gradlew bundleDev
* What went wrong:
Execution failed for task ':app:bundleStgDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable
   > Android resource linking failed
     error: failed to open '/home/runner/work/mpc-mobile/mpc-mobile/android/app/build/intermediates/proguard/configs/aapt_rules.pro': No such file or directory.

Is there a way to solve this?
I’ve already used the gradlew clean.

app/build.gradle


    buildTypes {
        release {
            shrinkResources false
            minifyEnabled false
        }
        debug {
            shrinkResources false
            minifyEnabled false
        }
    }

proguard {
    configurations {
      release { 
          defaultConfiguration 'proguard-android-optimize.txt'
          configuration        'proguard-rules.pro'
      }
      debug {
          defaultConfiguration 'proguard-android-optimize.txt'
          configuration        'proguard-rules.pro'
      }
    }
}

app/proguard-rules.pro

-dontwarn okhttp3.**
-keep class okhttp3.** {*;}
-dontwarn io.invertase.firebase.**
-keep class io.invertase.firebase.** {*;}
-dontwarn android.**
-keep class android.** {*;}
-dontwarn androidx.**
-keep class androidx.** {*;}
-dontwarn kotlinx.**
-keep class kotlinx.** {*;}
-dontwarn kotlin.**
-keep class kotlin.** {*;}
-dontwarn okio.**
-keep class okio.** {*;}
-dontwarn com.facebook.**
-keep class com.facebook.** {*;}
-dontwarn com.**
-keep class com.** {*;}
-keep class **.BuildConfig { *; }
1 Like

I solved this problem.
To create aapt_rules.pro, you must build apk before you build aab.
However, this method takes twice the build time.

1 Like