Error when include image_picker inside project (Flutter) Error when include image_picker inside project (Flutter) dart dart

Error when include image_picker inside project (Flutter)


Change your compileSdkVersion to 28 (under android/app/build.gradle)

compileSdkVersion 28

Then run the command

flutter clean

Then run the project again.


@PhucTran answer's is correct.Just want to add that i had to Invalidate Cache from Android Studio and Restart it.

File-> Invalidate Cahe and Restart


This error acquired if you upgrade the support libraries to 28.0.0 and your compileSdkVersion is not 28 also.

To fix it changes in file app\build.gradle

To fix it changes in file app\build.gradle compileSdkVersion and targetSdkVersion from current to latest(Now latest 29).

android {    compileSdkVersion 29...defaultConfig {    minSdkVersion 21    targetSdkVersion 29    multiDexEnabled true    ...}