Android Shared Library not Running - android

Okay I have a project that is using the android-rss library (org.mcsoxford.rss). I created a separate library project for the android-rss. When I try to run my project I get an error saying that the launch was canceled. "Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY". I went through the tutorial on Android on how to reference the library eclipse project. I have everything setup right. I also put in the xml file a uses-library. Not sure what the problem is. Here is my the uses in the Android-Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
<uses-library android:required="true" android:name="org.mcsoxford.rss"></uses-library>
...
</manifest>
And I have it referenced in the ANdroid Library. I can build the project and see the reference to the library in the project. No errors nothing. The reference lib is exported too.
Here are my console output errors:
[2011-04-18 11:46:43 - BOTM] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2011-04-18 11:46:43 - BOTM] Please check logcat output for more details.
[2011-04-18 11:46:44 - BOTM] Launch canceled!

I haven't check that yet, but maybe it will help.
Please download android-rss from: https://github.com/ahorn/android-rss and look into README file.
That part may be useful:
"To reference this library project from within your Android application,
navigate to the /tools/ directory and use the following command:
android update project \
--target \
--path path/to/your/project \
--library path/to/android-rss
This command appends to the "default.properties" file in your Android
project a new "android.library.reference" property. The value of this
new property should be the relative path to the directory which you
created when you fetched the Android RSS library source code with Git.
The library is compiled by the Android build framework when you build
your mobile app which was specified in the --path argument above."

Did you mention in the application launcher activity in the manifest file as follows,
<application>
<activity android:name=".LoginScreen"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Here Login screen is my main activity to launch as soon as app starts.

While installing the application on to the device, PackageManager checks for the shared libraries that are been used by the application.
If the shared libraries are missing on the target device, it will not allow user to install the application on that device.
So, basically the library "org.mcsoxford.rss" is missing from the device on which you are trying to install your application.
In order to over come this installation issue, you can make the following change on the manifest file:
android:required="**false**"
The above field states that you application will still work with out the library that has been mentioned on the uses-library tag. This will allow the application to be installed on the device, even if the shared library is missing.

Related

Import Unity Ads SDK in Android Studio

I just finished an app for Android and I would like to integrate ads on it with Unity Ads. I have to import the Unity Ads SDK project so, I went to : File/Import Module. Once done I entered the path of the folder but after that, I am blocked : Android Studio shows me that :
What should I fill ?
A newer solution:
Go to File > New > New Module > Import .JAR / .AAR package
Select your .aar file (already inside /app/libs dir)
Add this gradle's app dependency: implementation project(path: ':unity-ads')
Now you are ready to use the SDK.
I found solution.
Download and unzip master zip
Go Android Studio File --> Open Module Settings --> click plus button.
When dialog open, you should choose Eclipse project module.
Select unity-ads package in master project.
And Finish.
Stay happy to code :)
I have never tried to import Unity Ads to an non Unity project.
I found this in the Unity website I hope it can be helpful but it's for eclipse...
https://unityads.unity3d.com/help/Documentation%20for%20Publishers/Integration-Guide-for-Android
To answer your question. You shouldn't need to put anything there. It's only if you want to be able to view the source of the library - intelli-sense. That being said, I didn't like that set up and went a different route which I found easier.
Here's what I did.
Download and unzip the master zip (pre-built packages)
Copy or move the ./unity-ads-sdk-master/unity-ads/libs/unity-ads.jar to your projects ./libs dir.
Copy the permissions and Activity definition from the provided AndroidManifest.xml file.
<application>
<activity
android:name="com.unity3d.ads.android.view.UnityAdsFullscreenActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Note: If android:maxSdkVersion attribute leads to problems when merging manifests, you can
remove maxSdkVersion attribute. Unity Ads on Android 4.4 or later won't need this permission so
maxSdkVersion means it is only requested for older Androids. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
3a. Might need to refresh from your Gradle tool window.
Follow rest of instructions starting from Integrate Unity Ads to Your Codebase

After adding google-play-service_lib my resourceIds cannot be recognized

I am using ADT 23.0.2.
I just imported the google-play library to my workspace and added the reference to it in my project.
Now nowhere in my project the resource ids can be recognized because there is no R file.
(Anywhere I have R.id.blah I get the error "R cannot be resolved to a variable);
It's just gone. What am I supposed to do?
I exactly followed the steps by developers.google.com. It's nothing complicated but I don't know why this happened.
(I have all layout files in place and no import for android.R are in my class files.)
Before adding the
Tools I use:
Here are screenshots from my app properties:
My manifest
<permission
android:name="com.appname.appname4.MAPS_RECEIVE"
android:protectionLevel="signature">
</permission>
<uses-permission android:name="com.appname.appname4.MAPS_RECEIVE"/>
<activity
android:name="com.appname.appname4.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.appname.appname4.SearchResultListActivity"
android:label="#string/title_activity_search_result_list"
android:parentActivityName="com.appname.appname4.MainActivity" >
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.appname.appname4.MainActivity" />
</activity>
<activity
android:name="com.appname.appname4.ContactInfoActivity"
android:label="#string/title_activity_property_detail"
android:parentActivityName="com.appname.appname4.SearchResultListActivity"
>
</manifest>
I had similar issues when I first started Android programming. Here are some fixes that worked for me in the past.
1. Fix/Check all xml(layout) files.
Many times a R file not being generated is due to an issue with your layout file or Android Manifest file. Follow this link and work your way down the page checking permissions and the general layout format.
2. Project/Clean.
go to Project->Clean.
Also make sure you have selected the option to build project automatically.(Without this option check marked R file is never generated automatically).
3. Fix Project Properties.
Right click on your project in Package explorer then choose fix project properties.
Repeat Step 1 after this.
4. Builders.
Go to Project->Properties then Builders. Select the appropriate boxes.
Repeat Step 1, and Clean and rebuild project.
5. Appcom7 and Google Play services error.
Sometimes to fix errors associated with installing these two reference libraries. I copy there folders into a generic library folder on my hard(where I keep most of my eclipse reference libraries), after this I delete them from the Package explorer and from the "default" directory where they were installed. I Fix project properties again and clean/rebuild. This should get you back to your non-reference library version of the package. Then I manually add them as Projects to my eclipse IDE and finally follow this to add them as references to my project. Then fix project properties,clean and rebuild.
6. Reference Question.
Finally, referring to this StackOverflow page has helped me countless times. And one way or another fixed my issue.
Good Luck.

Android R.java will not generate in Eclipse

I am running Eclipse 4.2.2 Juno on Windows 64-bit for development on Android SDK 17 with ADT. Just today, I cleaned a working project, only to find that the R.java file would no longer generate.
This problem has a very divergent list of possible causes. User Gray, in response to the thread located here, listed a set of articles, all addressing different possible causes.
He says:
Dont worry. First you may clean the project, then run the project. If
this does not work then follow the following links:
And then proceeds to list articles pertaining to different causes of this problem, the links to which I am unable to include, but can be found in the question linked to above.
Gray's comment is a good summary of the most common causes to this problem, including resource file naming convention, the erroneous "import Android.R" statement, XML errors, corruption requiring cleaning and rebuilding, and checking the Android SDK in Project -> Properties -> Java Build Path / Libraries.
The problem is, my R.java still doesn't generate! The only remaining possibility within Gray's list seems to be that either my main.xml or AndroidManifest.xml is broken, so I have included them to make sure I didn't miss any errors.
My main layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.bostonwalker.sseng.SSSurfaceView
android:id="#+id/ssview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
And my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bostonwalker.enginedev"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
As a beginner Android programmer, this is beyond my capability to debug. Can someone please find an explanation?
First check if there are any errors in your resource file's. R.java will not be generated if that's the case. Check if you have updated your adt to rev 22. If so follow the below
Right click on your project goto properties. Java Build Path. Choose Order export tab. Make sure that Android Private Libraries is selected. If you have referenced library project. do the same for the library project also. Clean and Build.
Also goto android sdk manager and check that you have the android sdk build tools installed. This many not be necessary but make sure you have android build tools installed.
Check the link below
Eclipse error: R cannot be resolved to a variable
Whenever your generated R class isn't generated, it indicates that there's a problem with generating it due to some parsing issue from the XML resources. Check the error console in your IDE to figure out what's specifically wrong.
Common problems are:
An unescaped character in your strings.xml, for instance you're instead of you\'re
Missing layout_width or layout_height tags in layout resources
Missing namespace declarations
Variable names that aren't supported by Java, for instance due to capitalization or use of spaces, hyphens or other unsupported characters
Any other kind of syntax error in XML
In addition to what Reghunandan said, I just had the same issue after updating to SDK 22 with Eclipse Indigo Win x64. Turns out that when updating the SDK Manager uninstalled the old Build Tools and never installed the updated ones so I had to run it through again to get them reinstalled. Doing this fixed my issue and all the build errors disappeared.
Note: I had to restart Eclipse before the errors disappeared, even though I wasn't prompted to.
I faced a similar issue and found that I imported com.google.android.gms which had a reference to google-play-services.jar. So once I added the path of google-play-services.jar in my apps libraries, R.Java is generated.

Unable to instantiate activity ComponentInfo

I'm working with an Android project I've Imported from someone else. I've got all the dependencies sorted, there are no errors in the project, but when I try and launch it, I get:
04-08 16:49:41.761: E/AndroidRuntime(19254): FATAL EXCEPTION: main
04-08 16:49:41.761: E/AndroidRuntime(19254): java.lang.RuntimeException: Unable to
instantiate activity ComponentInfo{com.me.app/com.me.app.ui.ActivityDashboard}:
java.lang.ClassNotFoundException: Didn't find class
"com.me.app.ui.ActivityDashboard"
on path: /data/app/com.me.app-1.apk
My Manifest:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar">
<activity
android:name=".ui.ActivityDashboard"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
This seems to be a common problem, I've read all the other questions I've found and done the following, all to no avail:
ADT and the SDK are fully updated
I'm building against Android 2.3.3 (SDK 10)
This is selected under Android Build Target, and the Library is in the Java Build Path
All the classpaths in the Manifest are correct, I've double checked them all.
All Activities are in the Manifest, with the correct Intents.
and the Library is in the Java Build Path
That is incorrect. Please back out this change, then move the JAR into your project's libs/ directory.
While adding a JAR manually to your build path will satisfy the compiler at compile time, it will not add the contents of the JAR to the APK file at runtime, resulting in ClassNotFoundExceptions and the like.
Note that I am referring to third-party JARs, such as the first four entries in your screenshot. None of those appear to be in libs/, and all need to be.
The sole exceptions for the all-JARs-must-be-in-libs/ rule are:
Android's own platform JAR, attached to your project via selecting the build target (reason: this JAR's contents specifically does not need to be included in your APK)
Android library projects, which have their own libs/ directories for any third-party JARs that they reference
Your core error is that com.me.app.ui.ActivityDashboard is not found, suggesting that this is from one of your four JARs that are not in libs/.

How to get google ads sdk to work in Intellij?

Silly question (noob here) but the tag below in AndroidManifest.xml doesnt work in IntelliJ. The app compiles successfully but crashes on launch. This manifest file works fine in Eclipse. I added the googleadmob*.jar file in the sdk part of the project structure settings.
<activity
android:name="com.google.ads.AdActivity"
...
</activity>
The problem is that you've added the jar to the SDK. It must be configured as a module library instead, refer to the documentation. In this case it will be packaged with your application, while SDK is not packaged as it's already available on the device.
If the class is still shown in red in the editor, try File | Invalidate Caches.

Categories

Resources