酒店設(shè)計網(wǎng)站推薦百度學(xué)術(shù)搜索入口
文章目錄
- 教材學(xué)習(xí)
- 第一行代碼 Android 第3版
- 環(huán)境配置
- gradle配置
- 下載包出現(xiàn)問題
教材學(xué)習(xí)
摘要:選了幾本教材《第一行代碼 Android 第3版》,記錄一下跑案例遇到的問題,和總結(jié)一些內(nèi)容。
第一行代碼 Android 第3版
環(huán)境配置
gradle配置
- gradle的插件版本是3.4.0
- gradle的版本是5.1.1
- gradle的jdk版本是1.8
- build.gradle配置(之所以修改,是因為有時候有些包下載不下來,可以適當(dāng)提高gradle版本(如7.0)下載這些包,注意配置一下maven的url,出現(xiàn)ssl報錯,記得 配置allowInsecureProtocol true),不知道為什么之后下載完包后運行不了,還是把gradle設(shè)置為5.1.1才能運行代碼。
// 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 trueurl 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}maven {allowInsecureProtocol trueurl '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
}
下載包出現(xiàn)問題
可能是因為配置了android studio的代理,我的是macos 路徑在/Users/用戶名/.gradle/gradle.properties
,win系統(tǒng)應(yīng)該在c盤類似的地方。注釋掉配置的代理的2行
## 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=