ninia / jep

Embed Python in Java
Other
1.31k stars 149 forks source link

Jep Initialization crashes all the time #519

Open fakudzesamj opened 8 months ago

fakudzesamj commented 8 months ago

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):

bsteffensmeier commented 8 months ago

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.