Thanks to @Waytoon for the new tool Github Portal.
Thousands of words can not express the surging emotions, directly experience the tutorial and step on the pit.
1. Pull items
Visit GitHub to pull the latest main branch code:
git clone https://hub.fastgit.org/Waytoon/chimera_flutter_code_push
Copy the code
2. Download compile tool
https://hub.fastgit.org/Waytoon/chimera_flutter_code_push/releases
Copy the code
Download the rust_compile tool and copy it to chimera_flutter_code_push/compile_tool/. Overwrite the original file and add chmod +x rust_compile to the new rust_compile tool
3. Run the Hello project
Open the chimerA_flutter_code_push /example_project/hello project with the IDE and delete the wtbase directory. Go to the chimera_flutter_code_push/compile_tool/ and edit config.yaml as follows:
Environment: # hello projectPath: / Users/apple/Desktop/chimera_flutter_code_push example_project/hello # machine flutterSdkPath flutter SDK directory: / Users/apple/Documents/flutter # set up a temporary directory put casually buildCachePath cache files: / Users/apple/Desktop/hel_cache # # FTP temporarily do not need ftpConfig: 192.168.80.141 | root | 123456Copy the code
The./rust_compile command is executed successfully if the following output is displayed:
Start the compiling! projectPath: /Users/apple/Desktop/chimera_flutter_code_push/example_project/hello pubspec parse complete! ~ Compiled successfully! Generate Bin path /Users/apple/Desktop/chimera_flutter_code_push/example_project/hello/assets/hello.bin Compilation completed!Copy the code
4. Prepare the file server
If you are a MAC user, you can start a static service directly using python commands. Note that the command will directly to the current directory as the root directory of the service, so you need to first CD/Users/apple/Desktop/chimera_flutter_code_push/example_project/hello/assets, Then run python -m SimpleHTTPServer 8000, where 8000 indicates the service port
Other machines can consider starting a static server with nodeJS and so on, as long as the Hello/Assets directory is the root directory
The next step is to edit the hello/lib/main.dart file to change the downloadUrl to your own HTTP service
import 'package:hello/MyApp.dart'; import 'package:wtbase/wtbase.dart'; import 'package:flutter/material.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); bool isNative = false; If (isNative) {initApp(); } else {String downloadUrl = "http://192.168.0.11:8000/hello.bin"; readCode = WTAnalysisReadCode(); await readCode.loadFile(downloadUrl); readCode.executeMethod( 'package:hello/MyApp.dart', 'initApp'); }}Copy the code
4. Validation tests
- (1) The hello project root directory will be created automatically
wtbase
Directory. No modification is required - (2) Run the Hello project directly from the IDE. If it runs successfully, you can see the Hello World page of flutter
- (3) Use IDE to modify arbitrarily
MyApp.dart
Code, and then execute./rust_compile
Then open the Hello App on the terminal again and check the effect - (4) After the hot repair operation is: directly change the bug +
./rust_compile
+ Wait for the user to restart the app
5. The pit
-
Error when running hello project directly from IDE:
Running Gradle task 'assembleDebug'... ⣷ wtbase/lib/generate/mapping/WTVMScaffold dart: seeth: Error: Getter not found: 'DragStartBehavior'. drawerDragStartBehavior = DragStartBehavior.start, ^^^^^^^^^^^^^^^^^ wtbase/lib/generate/mapping/WTVMFloatingActionButton.dart:97:19: Error: Getter not found: 'SystemMouseCursors'. mouseCursor = SystemMouseCursors.click, ^^^^^^^^^^^^^^^^^^ wtbase/lib/generate/mapping/WTVMTextStyle.dart:72:30: Error: 'ui.Shadow' can't be used as a type because 'ui' doesn't refer to an import prefix. shadows: shadows? .cast<ui.Shadow>(), ^^^^^^^^^ wtbase/lib/generate/mapping/WTVMTextStyle.dart:73:40: Error: 'ui.FontFeature' can't be used as a type because 'ui' doesn't refer to an import prefix. fontFeatures: fontFeatures? .cast<ui.FontFeature>(), ^^^^^^^^^^^^^^ wtbase/lib/generate/mapping/WTVMTextStyle.dart:126:30: Error: 'ui.Shadow' can't be used as a type because 'ui' doesn't refer to an import prefix. shadows: shadows? .cast<ui.Shadow>(), ^^^^^^^^^ wtbase/lib/generate/mapping/WTVMTextStyle.dart:127:40: Error: 'ui.FontFeature' can't be used as a type because 'ui' doesn't refer to an import prefix. fontFeatures: fontFeatures? .cast<ui.FontFeature>(), ^^^^^^^^^^^^^^ wtbase/lib/generate/mapping/WTVMTextStyle.dart:184:30: Error: 'ui.Shadow' can't be used as a type because 'ui' doesn't refer to an import prefix. shadows: shadows? .cast<ui.Shadow>(), ^^^^^^^^^ wtbase/lib/generate/mapping/WTVMTextStyle.dart:185:40: Error: 'ui.FontFeature' can't be used as a type because 'ui' doesn't refer to an import prefix. fontFeatures: fontFeatures? .cast<ui.FontFeature>(), ^^^^^^^^^^^^^^ FAILURE: Build failed with an exception.Copy the code
Solutions:
(1) open the wtbase/lib/generate/mapping/WTVMScaffold dart to join code: import ‘package: flutter/gestures. Dart’;
(2) open the wtbase/lib/generate/mapping/WTVMFloatingActionButton dart to join code: import ‘package: flutter/rendering. The dart’;
(3) open the wtbase/lib/generate/mapping/WTVMTextStyle dart to join code: import ‘dart: UI as UI;
-
Hot update mode
isNative=false
Open the app white screen
(1) The project bandwidth may not be enough (it is not clear what bandwidth to take for white-hot repair and what to do), there is no solution, can only wait for the author to repair
(2) Maybe the product after rust_compile is broken, so we need to pull chimerA_FLutter_code_push the whole project again, and start again (oh my God!!!!!!!)
(3) There should be other problems, and I hope to improve them step by step.
-
rust_compile
Tool problem
(1) No log output after execution: let’s try again
(2) Execution error: download the tool in release again
-
Hot update failed or blank screen started
(1) It seems that adding showDialog is not supported at present, this needs to be verified