You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio构建失败:项目路径含非ASCII字符报错

Android Studio构建失败:项目路径含非ASCII字符的解决方案

解决方案

方法1:迁移项目至无特殊字符的路径

  • 将项目从当前路径 D:\PROYECTO OVO\�ltimo Avance - Angelo Canales\ProyectoOVO\ProyectoOVO 移动到不含非ASCII字符(如重音符号、特殊符号)的目录,例如 D:\Projects\ProyectoOVO
  • 重新打开Android Studio并执行构建

方法2:禁用路径检查

  • 在项目根目录的 gradle.properties 文件中添加以下配置:
android.overridePathCheck=true
  • 同步项目后重新执行构建

为什么修改targetSdk无法解决问题

错误日志已明确指出问题根源是项目路径包含非ASCII字符,这与targetSdk版本无关。修改targetSdk仅用于调整应用的目标Android版本,无法解决路径编码导致的Gradle插件加载失败问题。

提供的app模块build.gradle代码

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.proyectoovo"
        minSdk 21
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
    }
    namespace 'com.example.proyectoovo'
}

dependencies {
    implementation 'nl.joery.animatedbottombar:library:1.1.0'
    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
    implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'
    implementation 'androidx.work:work-runtime-ktx:2.9.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    implementation 'com.github.davidmigloz:multi-state-switch:2.0.1'
    implementation("io.github.vicmikhailau:MaskedEditText:4.0.7")
    implementation 'com.google.firebase:firebase-database-ktx:20.3.0'
    implementation platform('com.google.firebase:firebase-bom:31.0.2')
    implementation 'com.google.firebase:firebase-messaging-ktx:23.4.0'
    implementation("com.vanniktech:android-image-cropper:4.3.3")
    implementation 'com.google.firebase:firebase-auth-ktx'
    implementation 'com.firebaseui:firebase-ui-auth:8.0.1'
    implementation 'com.google.firebase:firebase-storage-ktx:20.3.0'
    implementation 'com.google.code.gson:gson:2.10'
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
    implementation "androidx.fragment:fragment-ktx:1.6.2"
    implementation 'com.github.harry1453:android-bluetooth-serial:v1.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'com.android.support:gridlayout-v7'
    implementation 'com.google.firebase:firebase-auth-ktx:22.3.1'
    implementation 'com.facebook.android:facebook-login:latest.release'
    implementation 'com.facebook.android:facebook-android-sdk:latest.release'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.firebase:firebase-analytics:21.5.0'

    implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.4.LTS'

}

内容的提问来源于stack exchange,提问作者David Vyhmeister

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 09:45:05