Can't build "real-world Android sample apps" in AIDE

99 views
Skip to first unread message

Iko Knyphausen

unread,
Feb 25, 2019, 10:43:12 PM2/25/19
to AIDE - Android Java IDE
Hello all,

I am new here, and new to Android app development. Installed AIDE and the free tutorials in the "Learn" section work nicely. When I move on to the "real-world examples" under the "Explore" section, none of the 4 examples (API Demos, Displaying Bitmaps, Immersive Mode, and Custom Choice List) will build. They all complain about missing packages and unknown methods, etc. My understanding was that installing AIDE will get you everything needed, no additional modules to install etc.

Oh, and yes, I paid for access to the "real-world examples", which makes it ever so slightly annoying ;-) 

Any advise or help is greatly appreciated. Also if you know of other sources for examples, that would be awesome as well. Looking to access the the phones hardware such as GPS, Camera, etc.

Thanks
-I

Split Infinitive Software LLC

unread,
Apr 25, 2019, 10:21:27 PM4/25/19
to AIDE - Android Java IDE
I found rhis the hard way, but it will help. (i hope)  AIDE/Andriod has a bunch of add-ons that can be included, they're caled maven libraries I believe, If your app need them you have to link them. Go to the file manager pane and navigate up or down until you see an option that says "Add to project..." click that and then find & select the needed library. That may fix your problem. If it doesn't and AIDE still marks some code as error you can fix it like this: On the error display pane long touch the error, and then the upper right of the app will change, if a box with a checkmark appears you can click it and it will give you an option that will fix the error. 

Yuriy Mironenko

unread,
Jul 5, 2019, 8:12:10 AM7/5/19
to AIDE - Android Java IDE
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

buildscript {
   
...
}

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 repository

After 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 exception
Error 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 написал:
Reply all
Reply to author
Forward
0 new messages