[Android] Problems encountered in rebuilding the Android project

There's no reason to rebuild my Android project, other than because I'm running out of space on my C drive. .
17 Why is your shader so big?  ?  ?
However, it was found that the gradle file on the C drive took up a large volume (4.7 G), so I decided to change the location of the gradle.

Change gradle location

By default, gradle stores cache files on the C drive, and the location can be changed through the following environment variables.

GRADLE_USER_HOME
  1. Close the AS to end the process
  2. Delete the .gralde under the user directory or do not delete it and move it down
  3. Open the environment variable settings and configure GRADLE_USER_HOME, no need to configure PATH

I put it here
This is also where I store the Android SDK.

The original folder can move all the things below it, or delete it. I just chose to delete it. Then open Android Studio and it will automatically re-download gradle and plugins.

kotlin version problem

question
When downloading, there are two jar files that cannot be downloaded. I really thought that Alibaba Cloud did not have these two files. Also went up to check. both
Later, I found out that the kotlin version I configured was wrong. Version
It needs to be consistent with the version here, so just change it to 1.7.10.

buildscript {
    
    
    ext.kotlin_version = '1.7.10'
    repositories {
    
    
        // 阿里云云效仓库:https://maven.aliyun.com/mvn/guide
        maven {
    
     url 'https://maven.aliyun.com/repository/jcenter' }
        maven {
    
     url 'https://maven.aliyun.com/repository/google' }
        maven {
    
     url 'https://maven.aliyun.com/repository/public' }
        // 华为开源镜像:https://mirrors.huaweicloud.com
        maven {
    
     url 'https://repo.huaweicloud.com/repository/maven' }
        // JitPack 远程仓库:https://jitpack.io
        maven {
    
     url 'https://jitpack.io' }
        // MavenCentral 远程仓库:https://mvnrepository.com
        mavenCentral()
        google()
        //jcenter()
    }
    dependencies {
    
    
        classpath 'com.android.tools.build:gradle:7.4.0'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10'

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

At this time, there is no problem with the build.
build

plugin version

The success of the build does not mean that there is no problem with the code. Here is an attempt to package it.
report error
The packaging failed because the version of kotlin changed and a change is required here as well. Google has a one-to-one correspondence with sites .
Correspondence
It can be seen that the compile version corresponding to 1.7.10 is from 1.3.0 to 1.3.1, so just change it to 1.3.0 here.

Guess you like

Origin blog.csdn.net/qq_37387199/article/details/130184402