zoukankan      html  css  js  c++  java
  • Android Studio开发常见问题

    Compilation failed; see the compiler error output for details

    错误描述

    解决方法

    原因:文件编码问题。进入项目根目录,在命令提示符下执行以下命令,查看有乱码的文件,为了避免文件乱码,全部设置为UTF8。找到乱码文件后用NotePad++打开,转为UTF-8无BOM方式编码保存即可。

    gradlew compileDebug --stacktrace

    引用第三方Jar包

    1. 复制到libs目录下
    2. 在jar包上点击右键Add As Library
    3. 在src目录下的build.gradle下面加上依赖jar包
      dependencies {
          compile files('libs/android-support-v4.jar')
          compile files('libs/zxing.jar')
          compile files('libs/gson-2.2.3.jar')
          compile files('libs/achartengine-1.1.0.jar')
      }
    4. 如果有问题  在项目目录下执行 gradlew clean后重新编译项目即可

    设置编码为UTF-8

    1. Settings -> File Encodings -> IDE Encoding / Project Encoding 可以自己选择编码GBK, GB2312或UTF8等,根据自己需要。
    2. 在src目录下的build.gradle最后指定编译时的编码
      tasks.withType(Compile) {
          options.encoding = "UTF-8"
      }
  • 相关阅读:
    文件操作(IO 技术)
    异常
    面向对象进阶
    面向对象
    函数用法和底层分析
    控制语句
    集合
    字典
    元组 tuple
    Python3 列表
  • 原文地址:https://www.cnblogs.com/shya/p/4413519.html
Copyright © 2011-2022 走看看