【问题标题】:Error importing json simple library to Android Studio将 json 简单库导入 Android Studio 时出错
【发布时间】:2017-04-29 15:11:33
【问题描述】:

使用我找到的 Android Studio 导入方法时出现此错误。

https://github.com/MagicMicky/FreemiumLibrary/wiki/Import-the-library-in-Android-Studio

我使用的导入方法在上面的链接中。

This is the error message (Click Here)

settings.gradle中是这样的

include ':app',':lib:json-simple-master'

这就是我编辑 build.gradle 的方式

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        compile project(':lib:json-simple-master')
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

这就是我尝试导入文件的方式

import org.json.simple.*;

【问题讨论】:

  • 好像你没看过NOTE: Do not place your application dependencies here

标签: java android json android-studio


【解决方案1】:

您不需要遵循这些说明

但是您编辑了错误的 build.gradle 文件。

像这样更新一个

android {
   ... 
} 

dependencies {
    ... 
    compile group: 'com.magicmicky.freemiumlibrary', name: 'library', version: '1.1'
} 

如果你想要一个JSON库,android已经有org.json...如果你想要Java对象反序列化,使用Jackson或Gson。

json-simple 在应用中似乎没有必要

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-13
    • 2015-05-21
    • 1970-01-01
    • 1970-01-01
    • 2018-07-22
    • 2016-02-22
    • 2014-02-24
    相关资源
    最近更新 更多