Flutter web build throws an error when main.dart file isn't in the lib root directory - flutter-web

I'm trying to build in production mode my flutter app for web, but I have my "main.dart" file not in the root lib directory, this cause to not be able to build my app for web, I have tried to point the path to where the "main.dart" file is, like:
flutter build web path/to/my/main/file/main.dart --release
But ended out with an error message like:
💪 Building with sound null safety 💪
Compiling lib/main.dart for the Web...
Target dart2js failed: Exception: .dart_tool/flutter_build/72a548668e340c281af31f7867ace19b/main.dart:8:8:
Error: Error when reading 'lib/main.dart': Error reading 'lib/main.dart' (No such file or directory)
import 'package:the_movie_db_app/main.dart' as entrypoint;
^
.dart_tool/flutter_build/72a548668e340c281af31f7867ace19b/main.dart:13:14:
Error: Method not found: 'main'.
entrypoint.main();
^^^^
Error: Compilation failed.
This command works when you try to build an APK, but not to build a flutter web app.
Can somebody please tell me how to solve this?

add -t before your main.dart path.
eg.
flutter build web -t lib/main-dev.dart

Related

angular : changing a file sends error and should restart 'npm'

When I change a file in my angular application it sends error:
ERROR in ./src/app/#theme/components/auth/index.js Module build
failed: Error: ENOENT: no such file or directory, open
'C:\Dev\Ng\ngx-admin\src\app\#theme\components\auth\index.js' i ï½¢wdmï½£:
Failed to compile.
And when I terminate the ng serve and re run, it is correct.
I dont want to re run it again.
What should I do to fix it?
Angular CLI cannot actually see files that you add when the server is running.
So it is better to give a fresh build by command.
CTRL C
ng serve -o
A similar question was asked here it will help to solve your doubt:
Source File Not Found in Angular CLI project

Building React Native source for Android NDK

I'm trying to build React Native locally. I followed the Facebook instructions from Building React Native from source
but when I do the command react-native run-android, I receive the following error:
:ReactAndroid:downloadBoost
Invalid cookie header: "Set-Cookie: sf_mirror_attempt="boost:iweb:boost/1.57.0/boost_1_57_0.zip"; expires=120; Path=/". Invalid 'expires' attribute: 120
:ReactAndroid:downloadBoost FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':ReactAndroid:downloadBoost'.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Any ideas as to what I may have done wrong?
The problem is that your computer is not able to download boost_1_57_0.zip file with the https path that is in your settings (invalid certificate).
Go to your project's project_root/node_modules/react-native/ReactAndroid/build.gradle file and change the src attribute on the task downloadBoost part to any proxy that you find to boost_1_57_0.zip and it should work.
I received a similar error and the error went away after using the correct Android NDK (currently android-ndk-r10e). But if you've followed the instructions, as you've said, then that is most likely not your problem.

Cordova build fails with file not found, but file exists

C:\Users\jamiller\Desktop\magicCarpetApp\platforms\windows8\cordova\lib>ls
WindowsStoreAppUtils build.js clean.js deploy.js log.js target-list.js
C:\Users\jamiller\Desktop\magicCarpetApp\platforms\windows8\cordova\lib>cordova build windows8
Running command: C:\Users\jamiller\Desktop\magicCarpetApp\platforms\windows8\cordova\build.bat
Building Cordova Windows 8 Project:
Configuration : Debug
Directory : C:\Users\jamiller\Desktop\magicCarpetApp\platforms\windows8
C:\Users\jamiller\Desktop\magicCarpetApp\platforms\windows8\cordova\lib\build.js(57, 5) WshShell.Exec: The system cannot find the file specified.
Anyone have any idea what's going on? It's failing on an error saying that build.js doesn't exist, but it clearly does. The permissions on it are fine as well and I should have full access to it.

Apportable load the tweejump-master makes errors

I try to use apportable to load the demo to my android phone.but have errors.
localhost:tweejump-master zhangxueyuan$ apportable load
Building with TARGET_ARCH_ABI:armeabi ARM_NEON:False
Building to /Users/zhangxueyuan/.apportable/SDK/Build/android-armeabi-debug
Warning: Falling back to toolchain version 4.7. Please run 'apportable update_toolchain'
Error: Could not find file /Users/zhangxueyuan/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin
and
localhost:tweejump-master zhangxueyuan$ apportable build
Building with TARGET_ARCH_ABI:armeabi ARM_NEON:False
Building to /Users/zhangxueyuan/.apportable/SDK/Build/android-armeabi-debug
Warning: Falling back to toolchain version 4.7. Please run 'apportable update_toolchain'
Error: Could not find file /Users/zhangxueyuan/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin
I refer to this link,and I think if the apportable will create a file to compile the project .
I think maybe change one file in the Folder:~/.apportable/SDK/site_scons/build/。
thanks
ok,i have find the answer。
i change the file /Users/zhangxueyuan/.apportable/SDK/site_scons/android/ndk.py
the number 303 to env['NDK_VERSION'] = '4.8'.
then
i apportable build the project again.
the result have errors: Could not find file /Users/zhangxueyuan/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86/bin
i find the only have the drawin-x86-64.
so i copy them by myself
use cp -R darwin-x86_64/ darwin-x86/
and try build project again.
apportable run ok!

When building blackberry10 cordova/phonegap project many files are missing

When building a blackberry10 cordova/phonegap project, a number of files are not included in the build. A number of splash screen images and the file "DEFAULT_BAR_NAME.bar" are not included.
However, if the same process is repeated on another device (desktop PC) all files are included. As far as I can tell, both have identical software setups.
C:\Users\USER\hello>cordova emulate blackberry10
[Error: An error occurred while emulating/deploying the blackberry10 project.
[BUILD] Populating application source
[BUILD] Parsing config.xml
[BUILD] Generating output files
[WARN] Failed to find debug token. If you have an existing debug token, please copy it to %HOME%/.cordova/blackberry10debugtoken.bar. To generate a new debug token, execute the 'run' command.
[ERROR] Error: Attribute image: file cannot be found in the list of packaged files: res/screen/blackberry/splash-1280x768.png
[ERROR] Native Packager exception occurred
[WARN] Failed to find debug token. If you have an existing debug token, please copy it to %HOME%/.cordova/blackberry10debugtoken.bar. To generate a new debug token, execute the 'run' command.
[ERROR] Error: Attribute image: file cannot be found in the list of packaged files: res/screen/blackberry/splash-1280x768.png
[ERROR] Native Packager exception occurred
[ERROR] Error: File does not exist or not a file or cannot read: C:\Users\USER\hello\PLATFO~1\BLACKB~1\build\simulator\DEFAULT_BAR_NAME.bar
If any more information will help then please ask, thanks!
I saw this message a bit late.
But I have a solution for this problem.
Browse to the root of your phonegap project (the one containing these folders merges,platforms,www & plugins)
Open the www folder
Open config.xml
Now carefully remove all the declarations for splash and icon for those platforms those are not added using cordova platform add command. For e.g if you have created a project only for blackberry remove all the icon and splash declarations for ios, android, webos, bada, windows-phone
Now run cordova build. Your blackberry app should be built without any errors.
I was able to compile my blackberry 10 app in phonegap 3.3
If you face any errors regarding p12 file then you need to follow the blackberry signing guidelines. Or if you got any doubts then mail me
hansolo.amey#gmail.com

Resources