including spen-sdk into android studio - android

Can anyone tell me the correct step by step way to include Spen-SDK into Android studio? The way I am including it allows the Samsung classes to be accessed from within the app but is leading to some weird problems(I have mentioned the problems here) which no one else seems to face.
Mentioning the steps here or directing me to the site which contains it would suffice. Thanks.

just copy the two .jar files from spen-sdk.zip folder and paste into the libs folder of your project.

An easier way to is to use the SDK Manager and add it there so your project can find it:
http://developer.samsung.com/technical-doc/view.do?v=T000000182L

Related

How to convert a project into a library project - and then use it

I have had a fully working app on google play for many months now.
I have been making lots of different versions by editing/un-editing it, but understand that the proper way to do this is convert your app into a library project and then have a variety of different projects / manifest files which then include the library.
I know I can go to properties/android and click "is library" to make my existing project into a library, but then what would my new "wrapper" project look like? Is there a nice online article describing this process?
EDIT: Just to be clear, my question isn't "how do I make a library project" (I think I've got that sorted), my question is "what does a project that does nothing other than execute the library look like?"... would it contain any .java files at all?
This artical shows basics of how to create library project with a good tutorial AndroidLibraryProjects
and We have the Android docs , which mention what constrains you should keep in mind while creating Library project here is the link Android Library Project doc
With a combination of guesswork and experimentation, I ended up with the following recipe...
Step one, clear the guts form the original projects manifest, so that it ends up simply as:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.mylibraryname"
android:versionCode="1"
android:versionName="1.00" >
</manifest>
Then in properties-android, tick "Is Library", then build the new library project.
Step 2, Ask eclipse to make a new android application project, but uncheck create activity.
Step 3. In the new project go to properties - android and in the Library box, select add, and you should now be able to select the original project as a library.
Step 4. Now paste the guts of the manifest that you took from the original project and paste them into the body of the new manifest.
Now just click run - nothing else to add.
Things to watch out for. If the original project had assets (like fonts), then copy these to the new project as they don't seem to get accessed from a library.
Your library's references to resource ID's are no longer simply constants, so they are not allowed in switch-case statements (convert to if-then-else).
If you have references in the manifest like: android:name=".my_class", then these will need to be changed to their full names like so android:name="com.company.mylibraryname.my_class".

Adding source files to android

Ok, i've wasted an hour trying to figure it out, even though it's something really simple.
I've downloaded some code from github. I'd like to use this in my android application. How do I go about adding it? It's not a jar file, and i tried drag dropping it and linking the files, and it didn't work. Importing and refreshing / cleaning the project didn't work.
I'm not sure where I'm going wrong. Any help is greatly appreciated!
If this is a project you want to import in eclipse, right click on eclipse left pane (the project list), import, android project from files, select the repository folder.
If this is a library you want to use in you app, there is another step : go to the properties of your project, android tab and in the library section click on add, then select the library project.
By design, android code that contains layout resources (for example ActionBar Sherlock) can not be embedded in a jar. So you have to use it as a library project. It is very convenient though, since it allows you to look at or modify the library code very quickly.
You may also need to let Eclipse know that your library project is a library and not an app. To do so, in the same Properties/Android screen you just have to check the "is a library" checkbox.
Reference on that topic : official documentation
In Eclipse:
File->New->Other->"Android Project from exiting Code"

Android - cannot use external library

I was asked to make a project work in Android and I am a complete noob in this aspect and, well... things are not working...
I have created a little code in Java which uses libraries - this code works perfectly. I am now trying to make this code work on Android but I have problems...
It seems I cannot use any element from the libraries I imported to my Android project. The project loads on the phone perfectly fine when no instance of the library is created, but when I make use of the library the app crashed and I get errors.
http://i.imgur.com/OILHQ.jpg
Here is what the project package looks like
http://i.imgur.com/HQEX9.jpg
The part with the arrow is what I think makes the program crashed. When I remove this line, everything works fine.
I checked online about problems with Android and external libraries but I could not understand everything... Could you help me pinpoint exactly what is wrong and how to solve this?
Thanks!
I got this issue when I first started android development.
Key to this is to the external library seems to require them being another android project itself, instead of java project. After creating this android project, right click on the "external project" and choose properties. Under Android Tab, there should be something to check to denote that it is a library instead of application. After doing this, the linking is quite similar to how we link normal java projects to external java library
If you are using eclipse, than just create a "libs" folder in project root and drop your external libraries there.
Alternatively you Right-click on the jar file > build path > add to build path

How to use the fragments backport?

Could somebody explain how I can use the Fragments backport? I downloaded the compatibility package with the manager, but I can't find the library that I have to link to my project to use fragments.
Thank you
In your SDK installation directory, you will find extras/android/compatibility/v4/android-support-v4.jar. Add this to your project's libs/ directory, and if you are an Eclipse user, also add it to your build path.
One thing though. There is a bug in the "stock v4" android jar which is pretty annoying - you cannot receive result of any activity started from within fragments, which makes it pretty much unusable for a lot of problems. There is however a fixed version of the jar which solves the problem (until v5 is in place I guess):
http://dev.polidea.pl/ext/android-support-v4-with-onActivityResult-fix.jar
And the issue is described here:
http://code.google.com/p/android/issues/detail?id=15394

default.properties not being created

I am using InteliJ Idea Community edition to develop android apps. I was trying to write UnitTests for a HelloWorld App as described in link text
. However I keep on getting an error
Found main project package: com.example.helloandroid
Found main project activity: .HelloAndroid
Error: Unable to load the main project's default.properties
On going through the files that were created by InteliJ Idea, I saw that all the files as mentioned in d.android.com/guide/developing/other-ide.html#CreatingAProject are being created except for defaul.properties and build.properties.
Is there any way we can create these files?
I had the same problem you're describing as I'm also developing using IntelliJ and these are the steps I followed to create a valid default.properties
1) Create a project using Android (with no IDE) the instructions are here. I created using exactly the same information than in my original IntelliJ project but looking at the resulting file it was not that important.
2) Copy the default.properties to your own project
In order to create the project you will have to know the id of the target you are using, you can obtain the list by executing android list targets.
Once I created the project I opened the default.properties file and the only thing important there was the target, in my case Project target.target=android-8
Hope this helps although your question is stackoverflow since a long time already.
Regards
PS: if I knew how to attach a file you wouldn't require to follow the above steps as the resulting file has no project specific information except for the target (if you want me to send it to you just tell me)
This is a bug and has been fixed but the fix has not been released yet:
http://youtrack.jetbrains.net/issue/IDEA-69343?projectKey=IDEA&query=android+default.properties

Categories

Resources