安卓教材学习

文章目录

教材学习

摘要:选了几本教材《第一行代码 Android 第3版》,记录一下跑案例遇到的问题,和总结一些内容。

第一行代码 Android 第3版

环境配置

gradle配置

  • gradle的插件版本是3.4.0
  • gradle的版本是5.1.1
  • gradle的jdk版本是1.8
  • build.gradle配置(之所以修改,是因为有时候有些包下载不下来,可以适当提高gradle版本(如7.0)下载这些包,注意配置一下maven的url,出现ssl报错,记得 配置allowInsecureProtocol true),不知道为什么之后下载完包后运行不了,还是把gradle设置为5.1.1才能运行代码。
c 复制代码
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {

        agp_version1 = '3.4.0'
        agp_version = '3.5.2'
    }
    ext.kotlin_version = '1.3.50'

//    ext.kotlin_version = '1.4.3'
    repositories {

        maven {
            allowInsecureProtocol  true
            url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
        }
        maven {
            allowInsecureProtocol  true
            url 'https://maven.aliyun.com/repository/gradle-plugin'
        }
        google()
        jcenter()
        
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$agp_version1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

下载包出现问题

可能是因为配置了android studio的代理,我的是macos 路径在/Users/用户名/.gradle/gradle.properties,win系统应该在c盘类似的地方。注释掉配置的代理的2行

c 复制代码
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Oct 05 22:36:26 CST 2023
# systemProp.http.proxyHost=
# systemProp.http.proxyPort=
相关推荐
Python私教3 分钟前
Python ORM 框架 SQLModel 快速入门教程
android·java·python
编程乐学1 小时前
基于Android Studio 蜜雪冰城(奶茶饮品点餐)—原创
android·gitee·android studio·大作业·安卓课设·奶茶点餐
problc2 小时前
Android中的引用类型:Weak Reference, Soft Reference, Phantom Reference 和 WeakHashMap
android
IH_LZH2 小时前
Broadcast:Android中实现组件及进程间通信
android·java·android studio·broadcast
去看全世界的云2 小时前
【Android】Handler用法及原理解析
android·java
机器之心3 小时前
o1 带火的 CoT 到底行不行?新论文引发了论战
android·人工智能
机器之心3 小时前
从架构、工艺到能效表现,全面了解 LLM 硬件加速,这篇综述就够了
android·人工智能
AntDreamer3 小时前
在实际开发中,如何根据项目需求调整 RecyclerView 的缓存策略?
android·java·缓存·面试·性能优化·kotlin
运维Z叔5 小时前
云安全 | AWS S3存储桶安全设计缺陷分析
android·网络·网络协议·tcp/ip·安全·云计算·aws
Reese_Cool6 小时前
【C语言二级考试】循环结构设计
android·java·c语言·开发语言