When creating a new application,

I encountered the following error when opening the “Open Android module in Android Studio”. I needed to access this section to change the application icon through the Image Asset option.

A build operation failed.
Could not create task ‘:shared_preferences_android:generateDebugUnitTestConfig’.
Could not create task ‘:shared_preferences_android:generateDebugUnitTestConfig’.
this and base files have different roots: …………

The solution I found is:

  1. Run flutter clean in your Flutter project directory using the terminal.
  2. Without running pub get, click “Open Android module in Android Studio”. Make the necessary changes.
  3. Once done, then run pub get for your application.

As of writing this article, this solution still proves to be helpful.


Sewaktu membuat satu applikasi baru,

saya menghadapi error dibawah apabila saya membuka “Open Android module in Android Studio”.

A build operation failed.
Could not create task ‘:shared_preferences_android:generateDebugUnitTestConfig’.
Could not create task ‘:shared_preferences_android:generateDebugUnitTestConfig’.
this and base files have different roots: …………

Saya perlu mengakses bahagian tersebut untuk menukar Icon applikasi melalui Image Asset option.

Solution yang saya temui adalah :

  1. run flutter clean menggunakan terminal di directory projek flutter anda.
  2. kemudian Tanpa Pub Get, click “Open Android module in Android Studio”. Lakukan perubahan yang diperlukan.
  3. Setelah selesai, barulah Pub Get applikasi anda.

Ketika artikel ini ditulis, fungsi tersebut masih lagi membantu.

Rujukan dari : Stackoverflow

By tajuzzaman

📍Kelabu Ventures 📍Aurora Cloud Works Sdn Bhd . A magician who writes code for computer, web, ios & android app . Servant of The One, Soldier of life