【发布时间】:2013-09-02 11:21:10
【问题描述】:
我已通过进入Project structure -> Modules -> myProject -> Tab-Dependencies -> + Sign 将外部库bsh-2.0b4.jar 添加到android-studio 中的android 项目,然后添加.jar 文件。
我还尝试将文件复制到 /libs 目录中,然后在工作室和add as library... 中单击鼠标右键(这两种方法都是独立的!!)。我插入了以下代码作为测试
import bsh.Interpreter;
...
Interpreter interpreter = new Interpreter();
interpreter.eval("result = (7+21*6)/(32-27)");
return interpreter.get("result").toString();
我使用 android 中的内置按钮进行编译。 build.gradle 看起来像:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 17
}
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
}
但是当我编译所有内容时,我收到了错误
Gradle: error: package bsh does not exist
Gradle: error: cannot find symbol class Interpreter
谁能帮帮我?
【问题讨论】:
-
如何编译?使用命令行或内置命令?你能发布 build.gradle 的依赖部分吗?
-
更新了gradle文件,我正在用内置命令编译
标签: java android gradle android-studio