如何在Android Studio中使用com.google.appengine.labs.repackaged.org.json(How to use com.google.appengine.labs.repackaged.org.json in Android Studio)
我有工作代码使用JSON与下面显示的包。
import com.google.appengine.labs.repackaged.org.json.JSONException; import com.google.appengine.labs.repackaged.org.json.JSONObject;代码在app引擎中运行,在eclipse下构建。 现在我正在尝试将其迁移到Android Studio。 但我无法找到如何用它来引用正确的库,所以我无法编译。 我当前的build.gradle文件如下所示。
buildscript { repositories { jcenter() } dependencies { classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18' } } repositories { jcenter(); } apply plugin: 'java' apply plugin: 'war' apply plugin: 'appengine' war.dependsOn appengineEnhance sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 dependencies { appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18' compile 'com.google.appengine:appengine-endpoints:1.9.18' compile 'com.google.appengine:appengine-endpoints-deps:1.9.18' compile 'com.google.appengine.orm:datanucleus-appengine:2.1.2' compile 'javax.servlet:servlet-api:2.5' compile 'javax.jdo:jdo2-api:2.3-eb' compile 'org.datanucleus:datanucleus-api-jdo:3.1.3' } appengine { downloadSdk = true appcfg { oauth2 = true } tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } enhancer { version = "v2" api="jdo" enhanceOnBuild = true } }我还需要添加其他库,但我想先解决这个问题。
I have working code which uses JSON with package shown below.
import com.google.appengine.labs.repackaged.org.json.JSONException; import com.google.appengine.labs.repackaged.org.json.JSONObject;Code runs in app engine, built under eclipse. And now I'm trying to migrate it to Android Studio. But I can't find out how to refer correct library with it, so I can't compile. My current build.gradle file is shown below.
buildscript { repositories { jcenter() } dependencies { classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18' } } repositories { jcenter(); } apply plugin: 'java' apply plugin: 'war' apply plugin: 'appengine' war.dependsOn appengineEnhance sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 dependencies { appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18' compile 'com.google.appengine:appengine-endpoints:1.9.18' compile 'com.google.appengine:appengine-endpoints-deps:1.9.18' compile 'com.google.appengine.orm:datanucleus-appengine:2.1.2' compile 'javax.servlet:servlet-api:2.5' compile 'javax.jdo:jdo2-api:2.3-eb' compile 'org.datanucleus:datanucleus-api-jdo:3.1.3' } appengine { downloadSdk = true appcfg { oauth2 = true } tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } enhancer { version = "v2" api="jdo" enhanceOnBuild = true } }There are other libraries I need to add but I want to fix this issue first.
最满意答案
我找到了解决方案。 在build.gradle中添加下一行成功编译。
compile 'com.google.appengine:appengine-api-labs:1.7.4'现在我可以继续运行/调试服务器端代码。
I found a solution. Adding next line to build.gradle made successful compile.
compile 'com.google.appengine:appengine-api-labs:1.7.4'Now I can go forward to run/debug server side code.
更多推荐
发布评论