I created a project using following command on windows environment
flutter create --org in.myorg helloworld
Project is created successfully
Flutter version is as below
Flutter 1.9.1+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aedbb1835 (3 weeks ago) • 2019-10-17 08:37:27 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0
When I run the code I get following error
e: D:\Project\test\helloworld\android\app\src\main\kotlin\in\myorg\helloworld\MainActivity.kt: (1, 9): Package name must be a '.'-separated identifier list
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 13.5s
Gradle task assembleDebug failed with exit code 1
.in domains are not allowed in flutter? using an incorrect domain will face issue while publishing app?
Yes, because in is one of Kotlin reserved keywords: keyword-reference
You can fix it by set Java as your Android platform language and not Kotlin.
Also, I think that this word is also reserved for Swift language.
I'm not sure if you can switch it on the fly but you can recreate your project with:
flutter create -i objc -a java command
Related
When I make a build of flutter project on windows(chrome) it run successfully but when i run on my phone it gives this error
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
tools Android SDK Tools
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
The SDK directory is not writable (C:\Users\Cantt)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 44s
Exception: Gradle task assembleDebug failed with exit code 1
I installed the Andriod SDK platform 32 and 31. please help how to fix this issue.
Open android studio and go to SDK manager
Check SDK platforms API level 28, 29, 30
Then apply and ok
Then
flutter clean
flutter pub get
flutter run
Try the following on Android Studio.
Help>Find Action and then search for each and select:
clean project
rebuild project
Invalidate caches
Then restart Android Studio.
This should fix the issue.
My app builds successfully in debug mode and runs fine but when using flutter run --release it gives some issues.
* What went wrong:
Task 'assembleAarRelease' not found in root project 'flutter_plugin_android_lifecycle'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run w
ith --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.
My flutter version is:
Framework • revision f04b3d917f (7 months ago) • 2020-11-07 16:09:02 -0500
Engine • revision 0f7cdca65f
Tools • Dart 2.12.0 (build 2.12.0-27.0.dev)
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /usr/lib/android-sdk
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 4s
Exception: Gradle task assembleDebug failed with exit code 1
You have to accept licences before building app in visual studio.
This is only one time configuration to be done. Have you done it?
If not then run following command:
In Windows
%ANDROID_HOME%/tools/bin/sdkmanager --licenses
In Linux
yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses
In macOS
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
If still problem persist then let me know.
I am just new to Flutter and I am trying to create the web according to my colleague's code but I engage the error below:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
Could not download x86_64_debug.jar (io.flutter:x86_64_debug:1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32)
Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32/x86_64_debug-1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.jar'.
Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32/x86_64_debug-1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.jar'.
Connect to storage.googleapis.com:443 [storage.googleapis.com/172.217.160.80] failed: Connection timed out: connect
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 36s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
flutter version
Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (4 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2
enviroment variables
FLUTTER_STORAGE_BASE_URL is https://storage.flutter-io.cn,
PUB_HOSTED_URL is https://pub.flutter-io.cn
May I have your help for the issue, it looks like a connection problem but I can get the X86_Debug download in the brower while I can't determine where to place the file. Maybe the directory where the file placed could be helpful too.
Using a VPN worked for me. I am using protonVPN.
When I tried to change the package name in MainActivity.kt inside kotlin the app doesn't run
This error:
e: /Users/dma/development/flutter_share/android/app/src/main/kotlin/com/example/souqmubtath/MainActivity.kt: (8, 7): Redeclaration: MainActivity
e: /Users/dma/development/flutter_share/android/app/src/main/kotlin/dev/dhari/souqmubtath/MainActivity.kt: (8, 7): Redeclaration: MainActivity
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 27s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 27.6s
Gradle task assembleDebug failed with exit code 1
You haven't changed your package name correctly,
Just go to the following path
android > app > src >main > kotlin
Inside that you will find one more package like your_package_name containing MainActivity file.
In your case it is like, "com.example.souqmubtath "
So to change it properly, just go to your android manifest file, from there just find package="com.example.souqmubtath"
Just select com.example.souqmubtath and refactor it.
For refactor either select the package name -> right click on it -> Refactor -> Rename.
OR
Just select the package name and use refactor rename shortcut which is Shift+F6
You can rename it to your desired package name. In your case it is like "dev.dhari.souqmubtath"
Also, go to your android > app > build.gradle file path. Inside the file and defaultConfig{} find out applicationId and refactor it as well to the same name as your package name.
Problem encountered on Flutter
packagename: com.[companyname].[binairyname]
In my case there were two folders in android/app/src/main/kotlin/com/
In this folder there were :
example/binary/*
companyname/binary/*
Since after a flutter create command the companyname in packagename are init to example, I deduced that the example folder should be deleted
Problem solved
flutter --version
Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f4abaa0735 (9 weeks ago) • 2021-07-01 12:46:11 -0700
Engine • revision 241c87ad80
Tools • Dart 2.13.4
You have to update the package name inside the MainActivity.kt on the top.
If this is correct then check your manifest file, is there package name updated or not?
Only the two reasons that your app not working.
There's a useful package for changing it but it works well with android, I didn't try for IOS.
Firstly install the package:
change_app_package_name: ^1.0.0
Then in the terminal in your project paths do these commands:
flutter pub get
enter code here
Then write the line below and use the unique name you want after com. then press enter:
flutter pub run change_app_package_name:main com.demo.flutter_app
will update files and delete old package names.