ninia / jep

Embed Python in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jep Initialization crashes all the time

fakudzesamj opened this issue · comments

Describe the problem
import jep.SharedInterpreter;
import jep.JepException;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    

}
public void onActionBt(View view) {
    SharedInterpreter jep = null;
    try {
        **jep = new SharedInterpreter();**

// crashes above giving me an error java.lang.IllegalStateException: Could not execute method for android:onClick

        jep.runScript("prikle.py");
    } catch (JepException e) {
        throw new RuntimeException(e);
    }

this code crashes all the time, realy how do you declare and initialize a Jep

Environment (please complete the following information):

  • OS Platform, Distribution, and Version: WIN 11
  • Python Distribution and Version:
  • Java Distribution and Version:JDK 1.8
  • Jep Version:4.2.0
  • Python packages used (e.g. numpy,):

You should close the SharedINterpreter when you are done with it. If that does not solve it then the exception you mentioned is coming from android, not from jep, if there is a caused by that implicates jep please include it.