美文网首页
【Android】安卓运行问题

【Android】安卓运行问题

作者: 在这蓝色天空下 | 来源:发表于2020-05-26 13:56 被阅读0次

    问题一:Could not resolve all artifacts for configuration ':fluwx:classpath'

    A problem occurred configuring project ':fluwx'.                                                                   
    > Could not resolve all artifacts for configuration ':fluwx:classpath'.                                            
       > Could not download kotlin-compiler-embeddable.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.72)    
          > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.3.72/kotlin-compiler-embeddable-1.3.72.jar'.
             > Read timed out                                                                                          
    > Could not get unknown property 'android' for project ':fluwx' of type org.gradle.api.Project.                    
                                                                                                                       
    * Try:                                                                                                             
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                                                                       
    * Get more help at https://help.gradle.org                                                                 
    
    • 第一步:修改掉项目下的android目录下的build.gradle文件,把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' }
    
    截屏2020-05-26 下午12.44.31.png
    • 第二步:修改Flutter SDK包下的flutter.gradle文件,这个目录要根据你的SDK存放的位置有所变化。比如我放在了这个路径
      /Users/lc/flutter/packages/flutter_tools/gradle/flutter.gradle
      打开文件进行修改,修改代码如下(其实也是换成阿里的路径就可以了)。
    • 如果还是解决不了,只能翻墙试试了

    问题二:Exception in thread "main" java.net.UnknownHostException: services.gradle.org

    Exception in thread "main" java.net.UnknownHostException: services.gradle.org
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:589)
            at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
            at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
            at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
            at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
    

    在Mac运行web项目的时候,出现主机IP找不到的问题。主要是因为在Mac中主机名和window有所区别
    一、输入命令

    cat /private/etc/hosts
    

    二、输入命令

    sudo vi /private/etc/hosts
    

    三、进入VI编辑器,增加如下的映射

    127.0.0.1 xxxxxxxxx
    

    四、最后,在终端中输入刷新的命令

    dscacheutil -flushcache
    

    问题三: Error:Execution failed for task ':app:mergeDebugResources'.

    解决方案:https://blog.csdn.net/qq_36317441/article/details/79320390

    问题四:GradleException显示红色报错解决办法

    throw new GradleException(...)
    替换
    throw new Exception(...)
    

    相关文章

      网友评论

          本文标题:【Android】安卓运行问题

          本文链接:https://www.haomeiwen.com/subject/lgvmahtx.html