Where to get and how to compile older android api samples - android

I honestly think Google really did not do a great job at keeping their Android documentation and training guides up to date. Numerous times I encountered situations where the documentation refers to samples that no longer exist.
Most recently I've been trying to learn about animation for Android.
Google seems to have a good API guide about animation:
https://developer.android.com/guide/topics/graphics/prop-animation.html
The guide refers to sample "com.example.android.apis.animation" in the API Demos sample. If you click on the "API Demos" link on that page, it brings you to another page with other samples.
After a bit of searching, I found the older samples have been moved and they can now be downloaded from git using this command:
git clone https://android.googlesource.com/platform/development
Once downloaded, the sample I am looking for can be found at "samples/ApiDemos". The only problem now is those samples don't have a build.gradle file. They must have been created at a time when gradle was not being used yet.
I am obviously new to Android and I am trying to learn the ropes. I am using android studio to build my projects. All the tutorials I've been reading use gradle to build the android application.
My question is in this post is (1) how to get to the older samples that are referred throughout the current Android API guides like the example above, I hope I have identified the correct git repo. (2) How the heck can I compile those older samples.

(1) how to get to the older samples that are referred throughout the current Android API guides like the example above, I hope I have identified the correct git repo.
The only way is to google and try to find them. There is no central repo for old versions of those (at least none that I'm aware of)
(2) How the heck can I compile those older samples.
Instead of opening those projects normally, close your current project (File > Close Project) and then choose "Import from Eclipse". This will look into all configs and generate a build.gradle for you.

Related

Outdated version of GitHub project loading in Android Studio

I'm trying to use a library from GitHub in my Android Studio Project (specifically, the Universal Image Loader https://github.com/nostra13/Android-Universal-Image-Loader).
My project has been crashing, due to an error with a variable called mMaxHeight, in a file called ImageViewAware.java
On the GitHub page, I see that this issue was 4 fixed months ago:
When I view the code in ImageViewAware.java on GitHub, I see that the issue is fixed.
However when I look at the version of ImageViewAware.java being used in my Android Studio, I see it's an older version, with the issue not fixed.
I've added
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
to my Gradle Dependency, as the documentation says, and have followed all other instructions I can see.
I notice that the last update to those instructions was over a year ago. Should I be implementing a newer version than 1.9.5? Is there another reason why the version in my Android Studio isn't getting the latest GitHub version?
I'm pretty new to this and feeling a bit out of my depth. Thanks for any help!
Alex
You are correctly using the latest published version of the library, v1.9.5.
However, there have been 23 unreleased commits to that library since then, as shown on the GitHub tags page:
To get the latest version of the code, you'll need to:
Download the library's zip.
Unzip it.
Manually add the dependency to your project.
This process is pretty straightforward, you may also be interested in this list of every difference between v1.9.5 and master.
However, I'd recommend against using this library if possible, given that it hasn't had a release / major update in 4.5 years! In the readme the author states he has stopped maintaining it. It also has over 400 open issues, despite the popularity.
More modern libraries like Picasso and Glide are much more widely supported, feature rich, and reliable.

Can anyone guide me through the steps about embeding libvlc in my android app?

This may look like a duplicate question, but all the previous answers were too much confusing for a ameature developer like me. I have never used NDK before and I am working with android studio and windows PC. Previous answers(1,2) and other sources are suggesting to use linux to compile. I couldn't understand what to do. Can anyone guide me through the steps about embeding libvlc in my android app
If you are having trouble with compiling vlc , then you can use the following library , thou it is unofficial , but I worked with it and it worked fine .
Unofficial VLC Android SDK
If you're on Windows 10, you should be able to follow the wiki at https://wiki.videolan.org/AndroidCompile/ using WSL (and google/use the videolan forum for what you don't know).
If you don't want to compile, another way could be to download the apk of the official vlc-android app, unzip it, extract the libs you want (namely libvlcjni.so and probably libjniloader.so) and add it to your project (which means making gradle happy).
vlc-android is a fully opensource app that does exactly what you want to do. Feel free to have a look.
Good luck

New to GitHub - is there a way to get an overview of projects on it before unzipping and building?

I've been looking for a finished/working ImageView on Android that has pinch/zoom behavior. Although there are code-snippets all over S.O. for this I want something a little more finished that I can just build and use.
GitHub, which I've never used before, seems to have candidates. As far as I can tell GitHub is a free, public project-hosting, source-control system, but I'm only interested in downloading and trying out projects on it, which can be done by the "Download Zip" button on it.
I recently tried a project called PhotoView but after getting it all imported into my Eclipse development environment I found it had dependencies on a higher API level than I was using or targeting.
Is there any way to avoid that in the future? I.e., is there any place on GitHub where the developers typically lists technical requirements like programming language, target development environment, compiler or SDK versions, etc, so before bothering to download a GitHub project I can guess whether it's even buildable in my environment?
Edit: In my browser I can see a brief revision history but it looks like it only goes back a few changes so the manifest or other key files aren't always visible. Is the only way to see the project files to download the ZIP file, unpack it and look at it in my development environment on my local PC?
Thanks in advance.
Is there any way to avoid that in the future?
Browse the source code. For example, the manifest file (for the component or a demo app) should indicate the android:minSdkVersion.
is there any place on GitHub where the developers typically lists technical requirements like programming language, target development environment, compiler or SDK versions, etc, so before bothering to download a GitHub project I can guess whether it's even buildable in my environment?
Yes. It's called the project README, and you were already there, most likely, as it is the "home page" of the repository. The amount of documentation any given developer will write for any given component will vary.
You are also welcome to file issues against the project, asking for more documentation on this sort of thing, but if and when that issue will be acted upon will also vary.
readme file in root of the project, and Wikipages of that repositories could help you find out additional information about that repository. But at the end, contributors are responsible to prepare this kind of information and some of them don't care. So, you can look for Android manifest file of the project and check the content in GitHub website before download and unzip it.

Where to download Android sources while Kernel.org is down

I'm looking for the android sources that are hosted on kernel.org (according to this site: http://source.android.com/source/downloading.html). However since kernel.org was hacked a few weeks ago, it is down. Is there a friendly fork of the sources somewhere (e.g. github) for me to clone?
There are indeed some parts available on github: https://github.com/android
But not everything I believe.
My starting point for getting it from github is here:
https://github.com/cellcortex/github_android
--- edit
pretty much gave up on using the half-complete github forks. Instead I chose to use http://www.cyanogenmod.com/ which has complete android OS sources on github.

Android framework source level debugging in Eclipse

the Java sources for the Android framework are available at source.android.com. Can I download and feed them to Eclipse so that I can step into framework methods while debugging? Better yet, does anyone know of an Eclipse plug-in that would get them from Android Git automatically as needed?
EDIT: during debugging, I can step through the framework code; I can see local variables by their declared names, and line numbers as well. It seems like the debug info is already there - only the source file is missing. While I can open it in parallel and watch the execution unfold, the question of version matching remains. Of many versions of the class file in Git, how do I pick one that matches whatever is running on the device (or emulator)? This is more of a Git navigation question - how do I pick up the very version of the file that went into Android release, say, 2.2?
EDIT much later: now sources come prepackaged with Android SDK. This question is somewhat obsolete.
This article nicely explains how to accomplish this: http://android.opensourceror.org/2010/01/18/android-source/

Categories

Resources