IllegalStateException: ViewPager2 does not support direct child views
记录一下ViewPager2 加载Fragment fragment布局包含ViewPager直接就崩
FragmentManager 参数用getChildFragmentManager()
viewPager.setAdapter(new FragmentPagerAdapter(getChildFragmentManager(),BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
Sdcard 路径创建失败
创建失败
Environment.getExternalStorageDirectory()+"/"+"Android/"+mContext.getPackageName()
创建正常
context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)
沙盒,简单而言就是应用专属文件夹,并且访问这个文件夹无需权限。谷歌官方推荐应用在沙盒内存储文件的地址为Context.getExternalFilesDir()下的文件夹。比如要存储一张图片,则应放在Context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)中。
在使用Android SDK 版本超过29编译的时候,Android Studio会提示[Environment](https://so.csdn.net/so/search?q=Environment&spm=1001.2101.3001.7020).getExternalStorageDirectory()过时了,要用Context#getExternalFilesDir代替,Android Q以后Environment.getExternalStorageDirectory()返回的路径可能无法直接访问,所以改成了Context#getExternalFilesDir
所以Environment.getExternalStorageDirectory()可以改成:
getExternalFilesDir(null);
得到的路径如下:
/storage/emulated/0/Android/data/yourPackageName/files
EditText 设置背景null,文字居中,结果显示偏上
设置padding 0 正常居中
Manifest merger failed with multiple errors, see logs
gradlew processDebugManifest --stacktrace
.9图报错 file failed to compile
用AndroidStudio打开图片,添加缩放区域,添加后图片会有一个黑色的缩放区域,截图如下
image.png
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/**
aspectjx {
//织入遍历符合条件的库
//includeJarFilter 'universal-image-loader', 'AspectJX-Demo/library'
//排除包含‘universal-image-loader’的库
//excludeJarFilter 'universal-image-loader'
//排除所有package路径中包含`android.support`的class文件及库(jar文件)
//exclude 'android.support','com.baidu','com.taobao','com.jakewharton','com.squareup','com.alibaba','com.tencent','com.alipay','com.huawei','org.apache','com.example.zxingdemo','com.google','com.handmark','com.lahm','tdx.com.tdxbdrecord','tdxweex','tdxbdtts'
exclude 'com.*.ConfirmPayModule'
include 'com.*'
}
More than one file was found with OS independent path 'lib/armeabi-v7a/*.so'
android {
...
// Fix: More than one file was found
packagingOptions {
pickFirst 'lib/armeabi-v7a/*.so'
}
}
flutter的一个包初始化报错BootstrapMethodError ->NoClassDefFoundError
报错代码
this.flutterState = new VideoPlayerPlugin.FlutterState(binding.getApplicationContext(), binding.getBinaryMessenger(), flutterLoader::getLookupKeyForAsset, flutterLoader::getLookupKeyForAsset, binding.getTextureRegistry());
猜测是lambda表达式解析导致的,build.gradle添加以下配置正常
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mszq.mscfhtest/com.tdx.Android.TdxAndroidActivity}: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.idlefish.flutterboost.Debuger.exception(Debuger.java:61)
at com.idlefish.flutterboost.FlutterBoost.registerPlugins(FlutterBoost.java:341)
at com.idlefish.flutterboost.FlutterBoost.createEngine(FlutterBoost.java:328)
at com.idlefish.flutterboost.FlutterBoost.doInitialFlutter(FlutterBoost.java:166)
at com.idlefish.flutterboost.FlutterBoost$1.onActivityCreated(FlutterBoost.java:70)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.idlefish.flutterboost.FlutterBoost.registerPlugins(FlutterBoost.java:339)
at com.idlefish.flutterboost.FlutterBoost.createEngine(FlutterBoost.java:328)
at com.idlefish.flutterboost.FlutterBoost.doInitialFlutter(FlutterBoost.java:166)
at com.idlefish.flutterboost.FlutterBoost$1.onActivityCreated(FlutterBoost.java:70)
at android.app.Application.dispatchActivityCreated(Application.java:209)
at android.app.Activity.onCreate(Activity.java:1090)
Caused by: java.lang.BootstrapMethodError: Exception from call site #10 bootstrap method
at io.flutter.plugins.videoplayer.VideoPlayerPlugin.onAttachedToEngine(VideoPlayerPlugin.java:63)
at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:133)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:27)
at java.lang.reflect.Method.invoke(Native Method)
at com.idlefish.flutterboost.FlutterBoost.registerPlugins(FlutterBoost.java:339)
at com.idlefish.flutterboost.FlutterBoost.createEngine(FlutterBoost.java:328)
at com.idlefish.flutterboost.FlutterBoost.doInitialFlutter(FlutterBoost.java:166)
Caused by: java.lang.NoClassDefFoundError: Invalid descriptor: LLL.
at io.flutter.plugins.videoplayer.VideoPlayerPlugin.onAttachedToEngine(VideoPlayerPlugin.java:63)
at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:133)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:27)
at java.lang.reflect.Method.invoke(Native Method)
at com.idlefish.flutterboost.FlutterBoost.registerPlugins(FlutterBoost.java:339)
at com.idlefish.flutterboost.FlutterBoost.createEngine(FlutterBoost.java:328)
at com.idlefish.flutterboost.FlutterBoost.doInitialFlutter(FlutterBoost.java:166)
at com.idlefish.flutterboost.FlutterBoost$1.onActivityCreated(FlutterBoost.java:70)
at android.app.Application.dispatchActivityCreated(Application.java:209)
at android.app.Activity.onCreate(Activity.java:1090)
.gradle\caches\5.6.2\executionHistory\executionHistory.bin 不存在,文件目录顺坏,读取不到*.jar
AndroidStudio编译项目报错
翻了下gradle文件夹下5.6.5下载了,看到是caches目录,直接把caches下的5.6.2删除,重新build项目,恢复正常
Android 嵌入flutter相关代码 Process 'command 'bin\flutter.bat'' finished with non-zero exit value 1
gradlew assembleDebug --info 查看具体信息
处理相关bug,修复完后正常运行
flutter packages get获取pubspec.yaml文件中列出的所有依赖包
flutter packages upgrade 获取pubspec.yaml文件中列出的所有依赖包的最新版本
../comprehensive_search/lib/mszq/ms_stock_search_page.dart:249:35: Error: The method 'getMSSortNum' isn't defined for the class
flutter 报错找不到libflutter.so
# ndk { abiFilters "armeabi" }打包apk,找不到libflutter.so
# lib/armeabi, /vendor/lib, /system/lib]]] couldn't find "libflutter.so"
先在gradle.properties中设置target-platform=android-arm
然后在项目的根目录的build.gradle project.setProperty('target-platform', 'android-arm')
指定打包的相关配置就正常运行了
Android 嵌flutter 界面出现下移
flutter界面在点击EditText弹出PopWindow粘贴板出现下移
屏蔽系统的粘贴板,未果,部分手机点击就会出现粘贴板
找布局变化发现多了个paddingTop
FlutterView.java ->onApplyWindowInsets WindowInsets insets paddingTop=56
SearchPage.dart->safe_area.dart 修改dart相关padding修复
AndroidStudio打开项目所有文件显示内容混乱
问题描述:
android studio 显示的内容错乱,xml中显示java代码,java中显示html代码。
本地代码显示正常,只在开发工具中查看有问题。
看到这个情况,真的是慌得一比,万能的清除缓存并重启,也不起作用了。
网上说
删除.gradle , .idea , build 三个文件夹,注意不要删错了哦。
然后改项目文件夹名称,测试OK
如果改完后运行报错,点击build->clean project ,然后再点击 rebuild project。无效。
然后找到另外一个解决方案:
.AndroidStudio3.5/system/cache
删除这个文件下 的东西重启就好了
2.0 Android Studio在运行时显示Please Select Android SDK的解决方法
用的好好的突然用不了->点edit下一步下一步finish,编译恢复正常
image.png
Cannot find a version of 'androidx.lifecycle:lifecycle-runtime' that satisfies the version constraints
报错显示不同依赖对应的lifecycle-runtime版本号不同
解决方案,project下强制所有使用较新版本
allprojects {
configurations {
all {
resolutionStrategy {
force "android.arch.lifecycle:runtime:2.2.0"
}
}
}
}
Warning: debug info can be unavailable. Please close other application using ADB: Monitor
改了一圈无果
adb usb 好了
参考[Warning: debug info can be unavailable. Please close other application using ADB: Monitor, - 简书 (jianshu.com)](https://www.jianshu.com/p/a7d6490967fd)
中国移动一键免密登录103102包签名错误
android应用签名 填写你密钥jks的MD5值(小写)
报错信息查询
//查看详细报错信息
gradlew compileDebugSource
Manifest merger failed with multiple errors, see logs
gradlew processDebugManifest --stacktrace
原生传参double给flutter 报错Caused by: java.lang.IllegalArgumentException: Unsupported Number type: class java.math.BigDecimal
当然你如果只是用来传Int就不需要处理 跳过吧
Android
JSONObject theJsonParam= new JSONObject();
JSONObject coordinate = new JSONObject();
coordinate.put("x",0);
coordinate.put("y",1.5);
theJsonParam.put("coordinate",coordinate);
Flutter
double x_coordinate = widget.params['coordinate']['x']
修改参数
coordinate.put("x","1.5");
var map = widget.params['coordinate'];
double x_coordinate = double.parse(map['x']);
网友评论