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.
Asked
Active
Viewed 1,729 times
1

J M Bhikadiya
- 129
- 2
- 14
-
add any other error you are getting too. and it is always better to add errors and code as text, so community member can copy that. – Viren V Varasadiya Apr 25 '20 at 10:25
1 Answers
0
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
- in Windows sdk.dir = C:\Users\USERNAME\AppData\Local\Android\sdk
- in macOS sdk.dir = /Users/USERNAME/Library/Android/sdk
- in linux sdk.dir = /home/USERNAME/Android/Sdk
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

R7G
- 1,000
- 1
- 10
- 15
-
I tried this but still same error occurred. Any other solution for this problem? @R7G – J M Bhikadiya Apr 24 '20 at 10:28
-
if you have windows machine put \\ instead of \ in path , also please download Android SDK if not present in that path – R7G Apr 24 '20 at 10:33
-
I tried to change \\ instead of \, but this was change automatically when I hit `flutter build apk` command. Also I have already downloaded and set android SDK and NDK. Any other solution for it? – J M Bhikadiya Apr 25 '20 at 06:49