Here I want build
apk
file for my flutter project. But a problem occurred when I build
APK
file with flutter build apk
command. I already define flutter SDK
path, android SDK
path, JDK
path in environment variable, but still this problem occurred. How to accomplish this?
Below I share the image of error which actually display in terminal.
You need to set the sdk dir for your project
Go to your Flutter Project -> Android if local.properties file was not there Create a file local.properties other wise open it Open the file paste your Android SDK path like below
Replace USERNAME with your user name
I will suggest to run
flutter clean .
before creating the app file
example of how a local.properties file data look like
for Windows
sdk.dir=C:\\Users\\UserName\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\src\\flutter
for Mac
sdk.dir=/Users/UserName/Library/Android/sdk
flutter.sdk=/Users/UserName/Desktop/Workspace/Flutter/flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1
where sdk.dir is the sdk directory for android and flutter.sdk is sdk directory for flutter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.