bsh-2.0b4.jar
android-studio の android プロジェクトに外部ライブラリをProject structure -> Modules -> myProject -> Tab-Dependencies -> + Sign
追加し、.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
誰でも私を助けてくれますか?