当前位置: 首页 > 知识库问答 >
问题:

如何解决颤振中的build.gradle错误。如何解决此错误“评估项目': app'时出现问题。>格式错误\uxxxx编码。”

杭志泽
2023-03-14

构建文件中有一个错误。我尝试了所有方法,但没有成功得到这个错误失败:构建失败,但有一个例外。

>

错误:评估项目“: app”时出现问题。

格式错误的\uxxxx编码。

>

  • 尝试:使用--stacktrac选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--can运行以获得完整的见解。

    在https://help.gradle.org获得更多帮助

    运行Gradle任务“AssemblereRelease”的6秒内生成失败。。。正在运行Gradle任务“AssemblereRelease”。。。完成7.4s Gradle任务AssemblereRelease失败,退出代码为1

    建筑android文件夹中的gradle文件

    '''   
    
    buildscript {
            ext.kotlin_version = '1.3.50'
            repositories {
                google()
                jcenter()
            }
    
    dependencies {
                classpath 'com.android.tools:r8:2.1.75'
                classpath 'com.google.gms:google-services:4.3.2'
                classpath 'com.android.tools.build:gradle:4.1.1'
                classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            }
        }
        
    allprojects {
            repositories {
                 google()
                 jcenter()
      }
    }
            
     rootProject.buildDir = '../build'
        subprojects {
            project.buildDir = "${rootProject.buildDir}/${project.name}"
        }
        subprojects {
            project.evaluationDependsOn(':app')
        }
        
        task clean(type: Delete) {
            delete rootProject.buildDir
        }
    
    '''
    

    建筑android应用程序文件夹中的gradle文件

    也尝试了此文件中所有可能的更改,但没有奏效,请提出一些更改建议。

    ''' 
     def localProperties = new Properties()
        def localPropertiesFile = rootProject.file('local.properties')
        if (localPropertiesFile.exists()) {
            localPropertiesFile.withReader('UTF-8') { reader ->
                localProperties.load(reader)
            }
        }
        
    
    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
        throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }
        
    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
        flutterVersionCode = '1'
    }
    
    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }
        
     apply plugin: 'com.android.application'
     apply plugin: 'kotlin-android'
     apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
       def keystoreProperties = new Properties()
       def keystorePropertiesFile = rootProject.file('key.properties')
       if (keystorePropertiesFile.exists()) {
           keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
       }
        
       
    
         android {
                compileSdkVersion 28
            
                sourceSets {
                    main.java.srcDirs += 'src/main/kotlin'
                }
            
            
    
    
    
      defaultConfig {
                // TODO: Specify your own unique Application ID 
     (https://developer.android.com/studio/build/application-id.html).
                applicationId "com.abhishekbhamare.covid19"
                minSdkVersion 16
                targetSdkVersion 28
                versionCode flutterVersionCode.toInteger()
                versionName flutterVersionName
            }
            
     
    
     signingConfigs {
           release {
               keyAlias keystoreProperties['keyAlias']
               keyPassword keystoreProperties['keyPassword']
               storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
               storePassword keystoreProperties['storePassword']
           }
       }
    
      
     '''
    

    提前感谢

    P、 这是我第一次在堆栈溢出上发布帖子,如果帖子格式有任何错误,请忽略,我对此深表歉意。

  • 共有3个答案

    邵耀
    2023-03-14

    我刚刚在Windows上遇到了同样的问题,对您来说可能也是如此。由于提到了编码错误,我从头开始编写key.properties文件的内容,而不是从flutter网站复制和粘贴,这可能会引入一些字符串编码问题。然后我不再有这个错误。我仍然有一些密钥库文件的路径问题,我也解决了这个问题,但这是另一个问题,而不是你遇到的问题。在这里,我只是试图满足Gradle移动密钥库文件,并将密钥库文件名调整为Gradle所期望的。然后我终于得到了一个签名的版本。

    周龙光
    2023-03-14

    key.properties文件中,当完成keystorepath store File=path to file时,对子目录使用“/”而不是“\”,即如果路径是C:/user/[username]/keystore.jks(在Windows中显示的路径)将其更改为C:\user\[username]\keystore.jks

    佘修为
    2023-03-14

    在你的钥匙里。属性文件,而不是storeFile=C:\用户

    使用这个storeFile=C:/Users/username/upload密钥库。jks公司

    将文件路径中的\替换为/

    如果是这种情况,这将解决错误。

     类似资料:
    • 问题内容: 我在下一行出现错误。我正在做添加到jsonarray的过程。请帮我。 问题答案: 这是我在重新编程时经常遇到的错误。此异常的原因或细节非常清楚。不允许在迭代时修改集合(正在添加新元素)。至少不支持语法。 为了解决您的问题,我认为有两种方法很简单。 1)。而不是使用语句来循环,更好的方法是使用迭代器来避免ConcurrentModificationException。 2)。在循环播放时

    • 当我试图运行我的应用程序时,我遇到了以下错误。 评估项目: app时出现问题。 提供的字符串模块表示法“commons io:common无法解析配置的所有依赖项”:app:debugRuntimeClasspath。s-io:2.6'无效。示例注释:“org。gradle:gradle核心:2.2','组织。mockito:mockito核心:1.9.5:javadoc'。 >

    • 最近,我在Flutter中遇到了一个错误: 谢谢。

    • 错误-mssql08(系统找不到指定的文件)java.io.FileNotFoundException:mssql08(系统找不到指定的文件)在java.io.FileInputStream.Open0(本机方法)

    • 我是python的新手。我使用anaconda Jupiter笔记本,我尝试使用一个名为weka的模块,我用pip安装了它。但现在我发现了这个错误: 文件“C:\ProgramData\Anaconda3\lib\site packages\IPython\core\interactiveshell.py”,第2961行,运行代码exec(代码obj、self.user、self.user) Fi