Hi, Iko.
It may be somewhat too late for you, but just in case...and for other users who may (well, they should be) encounter same problem.
There are two different error types in "Real-World Examples" of "Android App" set of courses of AIDE:
1) Failed to find support library.Error message: "Dependency 'com.android.support:support-v4:19.1.+' not found", appears in build.cradle file.
FIX: open build.cradle file (error list will show it) and copy
repositories {
mavenCentral()
}
section from
section to the beginning of the file. So there will be two
repositories sections after this manipulation: one inside the
buildscript and other at the "root" of the file at the beginning of it.
Mind: it will not work if copy repositories to the end of the file. You should put it before dependencies section.
And, finally, you need to refresh repositories, using
Menu / More / Settings / Build & Run/Refresh Maven repositoryAfter this, "
Dependency 'com.android.support:support-v4:19.1.+' not found" will go away together with several other errors in different file(s), which are result of trying to import of absent library.
P.S. Solution based on
https://developer.android.com/topic/libraries/support-library/setup , my intuition, and dozens of re-installs to confirm guesses.
2) Not-caught exceptionError message: "The exception 'java.io.FileNotFoundException' must be caught or declared in the throws clause"
FIX: Well, it's an uncatched exception. Just wrap all the content of the onActivityResult method into try-catch block for this exception. I.e. you have the method (all unhandled exceptions are inside this method)
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
...some code...
}
You should add
try-catch, which covers all the code:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
try
{
...some code...
}
catch (FileNotFoundException e)
{}
}
P.S. Exception handling code may be generated using the method described by the previous post of Split Infinitive Software LLC. You'll only need to relocate it so all the method code will be wrapped, not only one statement.
P.P.S.
throws clause (
https://beginnersbook.com/2013/04/java-throws/) do not works (this method overrides method of android.app.Activity, and this parent method has no this
throws specified).
вторник, 26 февраля 2019 г., 6:43:12 UTC+3 пользователь Iko Knyphausen написал: