How to compile Browser source code for Android 4.0.3 - android

I downloaded the Browser source code from https://github.com/android/platform_packages_apps_browser.
I am able to access the hidden and internal package with the help of http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/ tutorial.
I am not able to build the source code for Android 4.0.3. But when compiled for Android 4.0.3 Eclipse shows "This class must implement the inherited abstract method AbsSpinner.layout(int, boolean), but cannot override it since it is not visible from FolderSpinner. Either make the type abstract or make the inherited method visible" error in FolderSpinner class.
Thanks in advance for help.
Regards,
Vibhor

You can only build AOSP apps as part of the whole firmware. They are not designed to be built individually.

Related

Android studio test package won't autocomplete

I'm using android studio and have been able to properly import Robolectric.
When writing code in the test class it responds as though I'm simply using a textEditor.
To give an example of my problem: When I create a POJO I am able to give the constructor a the wrong arguments and the IDE doesn't respond at all.
And i do have the correct POJO import.
Powersave mode!
Put it off and your ide will work as usually ;)

Simulating Keyboard Events in Android

I have a project and I am trying to fire Keyboard events. I am using the Instrumentation Class, and it is working perfectly on the emulator, but when I launch it on my device, the call doesn't work, is there any way to make it work?
Also, I searched on the web, and I found some posts about the IWindowManager and the internal APIs, I fully understand the risk of using them, but my project is a research and is not intended to be published, so I don't mind using those APIs in my porject if they can solve my problem, but the problem is that I can't find the JAR that contains these classes.
TLDR : I need a solution that helps me fire keyboard events on my Android device, any ideas are appreciated
Actually, there is an easier method, that I found
Using Activity class or WebView class. Both have the same function.
The code looks something like this:
webView.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_1));
In instrumentation, there is the api to send keycode:
getInstrumentation().sendCharacterSync(int keycode);
If you have root access to the device, you can check the code here:
https://code.google.com/p/androidscreencast/source/browse/AndroidScreencastClient/src/net/srcz/android/screencast/client/ClientHandler.java ;
to use IWindowManager. The IWindowManager is apart of android system, you can find the class in android.jar, the source code can be downloaded from android official website.

create and use screen like android 4.0.4 call screen

I want to reuse android 4.0.4 call screen. but I cant access some widget classes which they are using. Can any one suggest me. Thanks in advance.
The source to Android is available; nothing prevents you from downloading it, getting the source to the widget you're interested in, and including that source (and any resources it needs) in your project. People have been doing this since Android was introduced.

libgdx and TWL: Android app force closes on any TWL menu, works fine on Desktop

I am implementing menus using TWL (http://twl.l33tlabs.org/) in an app written using Libgdx. The app runs fine if I don't start any menus, but as soon as I go to a menu screen it immediately force-closes. Menu screens work fine on the desktop version.
In which build path should TWL-android.jar be included (right now it behaves the same in main, android, and both)? And how will the program know to use the libraries from this .jar instead of the default gdx-twl.jar? Will I have to manually implement something in code to use one or the other depending on platform?
There does not seem to be any documentation or sample code of anyone using TWL on android, only mentioning that it can be done.
Running debugger attached to phone gives the following logcat error:
Could not find class 'com.badlogic.gdt.twl.Layout' referenced from method com.Nanners.OptionsScreen.<init>
I think that TWL-android.jar should be added to android project's build path too. Location of .jar is not relevant.
When you add TWL-android.jar. As that is Android specific you can't use it on the core project, so the classes you are importing are the ones from gdx-twl. To make it simpler to explain I will divide it in different escenarios.
You add TWL-android to your Android buildpath. But you use Gdx-twl in your core project. Which isn't added. Thus getting a:
Could not find class 'com.badlogic.gdx.twl.Layout'
You add both TWL-android AND Gdx-twl to your build path. Thus getting duplicated classes and:
Conversion to Dalvik format failed with error 1
Solution
If you use TWL-android classes, you can only do it inside the Android project:
Merge Core, Desktop and Android project. Or
Use Interfacing with Platform Specific
If you use Gdx-twl:
Don't do it.
Actually the best solution is to get rid of all twl stuff and use Scene2d.Ui instead. Its crossplatform and much easier to use.

Force close before onCreate, activity class not found exception

I just started testing my app on android 1.5, and it doesn't want to run at all. I have a breakpoint in onCreate on my main activity, but I get a ClassNotFound exception even before reaching that. The class not found appears to be the class of my main activity. The exception happens in:
ActivityThread.performLaunchActivity
It runs fine on 1.6 and later, so I assume I'm using something that isn't supported on 1.5. But how can I find out what it is? Any tips on how to debug this would be greatly appreciated.
Thanks.
If you have imported jars, verify that they are in the /libs directory and not in the /lib directory and they are imported as jars and not as external jars
I had the same problem today. It's difficult to identify which class is not supported. The stack trace doesn't really shed any light on it, it just gives the somewhat misleading message that your activity class cannot be found. A couple API's that I have used that I know are not in Android 1.5 are:
- Bluetooth (2.0 and up)
- Text to Speech (1.6 and up)
I ran into this issue because I added support for text to speech to my app and didn't think to check the docs first to make sure text to speech is supported on Android 1.5. I was dismayed to learn it was only added in Android 1.6. To work around the problem I had to do a couple things:
Remove the "import android.speech.tts.*" from my activity
Create wrapper classes that mirror the text to speech API and call the real text to speech classes from there.
Put if statements around the calls to my wrapper class to make sure I only call out to it if the Android SDK level is 1.6 or above. You can check the Android SDK level by inspecting android.os.Build.VERSION.SDK
In your Android Market listing, indicate that the text to speech functionality is only available if you have Android 1.6 or higher installed.
The nice thing about this approach is that in the future, when I decide to abandon support for Android 1.5 I can easily change my calls to my wrapper class to just call the text to speech API directly and rip out the wrapper classes.
I did something similar for my Bluetooth code.

Categories

Resources