Android 项目开发中遇到的问题

1、Android studio Gradle 加载依赖太慢?
解决办法如下:
buildscript {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}        

}

allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
}

将Gradle 的资源加载服务器换成阿里巴巴的,这是国内自己搭建的服务器,gradle 加载相对快一点。

  1. 使用Shape 画圆角矩形
    <?xml version="1.0" encoding="utf-8"?>
    <shape
    xmlns:android="http://schemas.android.com/apk/res/android">

    <solid
    android:color="#ffffff" />

    <stroke
    android:width="1dp"
    android:color="@color/rgb53_99" />

    <corners
    android:topLeftRadius="5dip"
    android:topRightRadius="5dip"
    android:bottomLeftRadius="5dip"
    android:bottomRightRadius="5dip" />

</shape>

  1. 关于Android studio 中引入moundle 无法使用依赖。

在module中导入了***.jar或者在线的包,在app中如果想引用这个jar里相关的内容时,发现根本引用不到,会提示你add library/*****.jar 一大串,你回车一下或者点一下没反应,根本没有用。

只需把module下gradle里相关jar的implementation改为api即可,因为implementation 修饰的只能在当前module中引用,你在app下是引用不了的,你改完重新编译下即可进行引用了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容