I am trying to build flutter app in release mode. I tried to do flutter build appbundle in the terminal and i get the following error.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'sqflite'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/abdu/Downloads/flutter_linux_v1.12.13+hotfix.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0/android/local.properties'.
This is my first time building an app and I don't have no idea how to fix this. Any help would be appreciated. Thank you.
try adding Android home path:
export ANDROID_HOME=$HOME/[folder if you have any]/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Add the above lines to the file ~/.bashrc (located at home/username/.bashrc) . Run source ~/.bashrc to apply the changes or restart your terminal..
to check
echo $ANDROID_HOME
..
Related
When I tried to run Flutter app on windows, it gives an error then says Exited Sigterm. or stmh like this.
the error says;
Re-run cmake with a different source directory
cmake files does not match...
etc.
The Steps that helped me to handle this error are;
open your terminal then write following commands
flutter clean
flutter pub get
flutter run
This will remove you build file and re-create it.
Your problem should have solved now.
Even I have the file in lib/ folder flutter gives me error
Here is my file
C:\SRC\flutter\packages\flutter_tools>flutter run
Target file "lib\main.dart" not found.
Edit:
here is my configuration
I have looked to this topic
Getting error like "Target file "lib\main.dart" not found." whlie building APK in flutter
But this situation is different from mine.
Reason:
This is the error because of the main execution starts searching main file, but can't find it.
Solution:
Go to Edit Configurations...
Set here main.dart file as dart entry point here and save it...
Another Solution
Run following command
flutter run -t lib/main.dart
I tried to build the project from vs code terminal but it just threw an error
According to the image, there is another folder inside of flutter-quizstar-master-step, therefore execute:
cd flutter-quizstar-master
then
flutter build apk
C:\flutter\flutter_windows_v1.9.1+hotfix.2-stable\flutter\bin\flutter.bat --no-color build apk
Target file "lib\main.dart" not found.
Process finished with exit code 1
You can set an entry point like this:
flutter run --target=lib/Login.dart
flutter build apk --target=lib/Login.dart
This article shows you how to set up IDE (VSCode/AS) to build another target file.
I don't think you should be changing the entry file, you can always use the main.dart without issues and then set the Entry class there. This doesn't stop your app from working.
When I build a new ionic app to android ,
Compilation failed .
The error is as follows:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Remote host closed connection during handshake
Anyone can help me? I am confused.
OK, I know how to solve this problem.
First steps: Ansure have download jdk and set the 'java_home' and 'classpath';
Second steps: Ansure have download node, which verison is 1.8+;
Third steps : Downloading android studio , in this step will auto upset gradle and SDK;
After do above three steps, u can use android studio create a new blank android app an run simulator.
The last steps: set system enviroment variable 'SDK_HOME' and 'ANDROID_HOME' like this:
ANDROID_HOME E:\sdk (this is my computer setting)
SDK_HOME E:\sdk
path %SDK_HOME%\tools;%SDK_HOME%\platformtools;C:\Users\xxxxx\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-3.1
EDIT:
Correction in folder name: platform-tools
%SDK_HOME%\tools;%SDK_HOME%\platform-tools;C:\Users\xxxxx\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-3.1