diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 0000000..dde36c1 --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,18 @@ +## Flutter wrapper +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } +-dontwarn io.flutter.embedding.** + +## AMap 3D Map +-keep class com.amap.api.maps.**{*;} +-keep class com.autonavi.**{*;} +-keep class com.amap.api.trace.**{*;} + +## AMap Location +-keep class com.amap.api.location.**{*;} +-keep class com.amap.api.fence.**{*;} +-keep class com.autonavi.aps.amapapi.model.**{*;} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 69bcc55..5407f7a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,7 +28,8 @@ void main() async { // await AmapCore.init(''); // await AmapLocation.instance.init(iosKey: ''); JPush jpush = new JPush(); - DevUtil.setDev(true); + const isProduct = const bool.fromEnvironment('ISPRODUCT'); + DevUtil.setDev(!isProduct); jpush.addEventHandler( // 接收通知回调方法。 onReceiveNotification: (Map message) async { diff --git a/tool/grind.dart b/tool/grind.dart index 707ddd6..caa93b4 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -13,3 +13,20 @@ build() { @Task() clean() => defaultClean(); + +@Task() +buildApk() async { + await runAsync('flutter', arguments: [ + 'build', + 'apk', + '--target-platform=android-arm64', + '--dart-define', + 'ISPRODUCT=true' + ]); +} + +@Task() +buildIos() async { + await runAsync('flutter', + arguments: ['build', 'ios', '--dart-define', 'BUILD_TYPE=PRODUCT']); +}