Closed AmrSubZero closed 8 years ago
After "Unfortunetely App has stopped" you will receive stack trace in LogCat. Did you read it?
@AmrSubZero You seem to be instantiating the app correctly. I will need to see a stack trace to understand the problem. Can you get a stack trace?
@AmrSubZero
Having thought about this some more, I speculate that the code is causing a Throwable
or RuntimeException
. I see you have a catch there with a printStackTrace()
, so assuming you can get the output of a print, I suggest you change your code like this:
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
ApiConnection.connect("192.168.1.2");
} catch (MikrotikApiException e) {
e.printStackTrace();
}
catch (Throwable e) {
e.printStackTrace();
}
}
}
At least we'll then be able to pick up why the app is stopping. Please let me know, or if this issue is no longer relevant, please close the issue.
Developing an android application testing the connection to the RouterOS using this API
Added the Maven compile code to the build.gradle in my android app :
Imported the Class of the API :
And here's my code in the MainActivity :
As we see it's very simple, nothing complicated just trying to connect
The problem is when i test the app it's crashing and saying
I assume i'm using the API the right way, so how to fix this problem?