bsh-2.0b4.jar通过进入Project structure -> Modules -> myProject -> Tab-Dependencies -> + Sign然后添加 .jar 文件,我已将外部库添加到 android-studio 中的 android 项目中。我还尝试将文件复制到 /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
有人可以帮我吗?



