问题一:解决pods-frameworks.sh:permission denied问题
打包的代码在其他电脑中打开,无法在iOS模拟器中运行,报错具体信息:
11111.png
最终解决方案为:
在终端输入
chmod a+x “/Users/***/Pods/Pods-resources.sh”
***为pods文件夹所在路径
33.png
问题二:
Warning! This package referenced a Flutter repository via the .packages file that is no longer available. The repository from which the 'flutter' tool is currently executing will be used instead.
running Flutter tool: /Users/***/development/flutter
previous reference : /E:/development/flutter
This can happen if you deleted or moved your copy of the Flutter repository, or if it was on a volume that is no longer mounted or has been mounted at a different location. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your path).
a、在终端中实例SDK路径:
flutter config --android-sdk /path/to/android/sdk
b、在Android studio中,选择Tools -> Flutter -> Flutter Clean。
如果问题依然没有解决,请查看环境变量路径配置是否正确、是否缺少,项目设置中flutter sdk的路径是否正确
问题三:
The argument type 'CachedNetworkImage' can't be assigned to the parameter type 'ImageProvider'.
解决方法1:
该cached_image_network
提供class
的是extends
ImageProvider
,即CachedNetworkImageProvider
:
Container(
width: 80.0,
height: 80.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: CachedNetworkImageProvider('https://p.ssl.qhimg.com/dmfd/400_300_/t010774c3ffd8c986a2.jpg
'),
),
),
)
解决方法2:
因为BoxDecoration 可以在任何小Widget上使用,所以我们可以省略DecorationImage小部件来实现:
Container(
width: 80.0,
height: 80.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: CachedNetworkImage('https://p.ssl.qhimg.com/dmfd/400_300_/t010774c3ffd8c986a2.jpg
'),
)
问题四:APP打包安装后无法访问网络
缺少网络权限:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
在android/src/main/AndroidManifest.xml中添加以上权限使用申请的配置,打包再次安装就可以访问网路了
问题五:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
启动后一直处于这种状态下,一般是gradle文件下载不了的情况。可以尝试自己下载gradle文件,我的是4.10.2版本,下载之后,
找到自己机子里gradle的存放路径,这个路径是隐藏的,我的在C:\Users\xxx.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv下,把下载的zip包复制到这里并解压,重新运行。
问题六:
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/Users/xxx/develop/android/flutter_app/android/gradlew" exited abnormally:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
......
Finished with error: Please review your Gradle project setup in the android/ folder.
出现这样的错误提示,通常是网络无法翻墙造成的,但是也不排除一些同学没有完成环境变量的配置,所以请先检查在系统环境变量中是否配置了ANDROID_HOME的路径,在用户变量中的Path中,是否配置添加了%ANDROID_HOME%tools
如果问题依然没有解决?咱们继续:
步骤1、
修改build.gradle,注释掉jcenter(),google(),使用阿里的镜像
buildscript {
repositories {
//google()
//jcenter()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
//google()
//jcenter()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}
}
步骤2、
找到flutterSDK目录,我的是下载保持到了D盘,
D:\development\flutter\packages\flutter_tools\gradle
找到下 flutter.gradle文件 找如如下内容替换成和我一样的 把jcenter注释掉。
buildscript {
repositories {
//jcenter()
//maven {
// url 'https://dl.google.com/dl/android/maven2'
//}
maven{
url 'https://maven.aliyun.com/repository/jcenter'
}
maven{
url 'http://maven.aliyun.com/nexus/content/groups/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
网友评论