I took a fully working application and copied it and made it a library (Properties -> Android, Is Library). I also renamed this project to keep track of it separately - com.mylib.
I then took the original application com.myapp and removed all the .java files except for one with some data (no actual code). I linked this up via Properties -> Android, and in the Library section added in the mylib library. It shows up with a green check.
Changed the myapp's manifest activities to all have the library as the prefix as recommended by Google.
android:name="com.mylib.AppInfo"
Cleaned both the library and the project, and exited and restarted Eclipse as well. Compiles fine, and the program runs the main activity "AppInfo", but attempting to get to other activities always fails with ClassNotFoundException.
I've also tried different name prefixes in the myapp manifest such as:
android:name="com.myapp.AppInfo"
android:name=".AppInfo"
But these fail to get to the main app. Although no activity class names were changed in the library or the myapp manifest, I've reviewed them character by character to be sure they all match up both in case and exact letter.
Using Eclipse under Windows 7 x64, and the app is set for minSdk of 11. Latest SDK tools also loaded (v20.0.3). Also Proguard is not being used (yet), and I'm using actual hardware (Android 4.0).
I'm pulling my hair out trying to get the library to work. I have a completely different library and app pair working the same way on another project, and I've compared every property and option between the two libraries and projects and can't find anything that is missing or added that causes this to fail.
Here's the full error from LogCat:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.LiveWallpaperSettings}: java.lang.ClassNotFoundException: com.myapp.LiveWallpaperSettings
Any suggestions or ideas on how to track this down?
Related
My game is able to build and run on debug mode so I was hoping it would be ready to be built in release mode but I'm currently stuck with this error in the title. Anyone knows the solution?
EDIT : I've tried commenting the imageAspectRatioAdjust in common_attrs.xml but it would cause alot more different errors.
EDIT : I've found out that there is two file that contains imageAspectRatioAdjust in the release folder of my game when I tried to build it, but there is only 1 file that contains imageAspectRationAdjust in debug. Even if I tried to delete one or the other, I have to clean and rebuild and it would reappear again in the same folders.
I've added Facebook Android SDK into a sub project which a main project is dependant on, which requires me to add Facebook Android SDK into the main project as well but I've accidentally updated some of the packages in the component on the main project and did not update the packages on the sub project, which seems to be the cause of this error.
I am trying to port an Android app in Android Studio to Visual Studio 2015 / Xamarin. I try to run the project and I get:
Android application is debugging.
The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).
Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.
I added [Activity(MainLauncher = true)] to the main class and checked Build->Configuration which appears to be correct, but these have no effect.
I get this warning:
Cannot find annotation method 'anyOf()' in type 'RequiresPermission':
class file for android.support.annotation.RequiresPermission not found
MyApplication.Native.Droid C:\Users\allelopath\AppData\Local\Xamarin\GooglePlayServices.Maps\8.4.0\embedded\classes.jar(com/google/android/gms/maps/GoogleMap.class)
I also get this warning:
Warning
Found conflicts between different versions of the same dependent assembly.
In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts;
otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
Acquaint.Native.Droid
I double click as it suggests and it asks:
Do you want to fix these conflicts by adding binding redirrect records in the application configuration file?
I click Yes. This ultimately has no effect, after rebuilding and trying to run, the warning reappears.
I unstalled the app on the device, which had been there from running it on Android Studio, but this had no effect either.
What can you suggest?
For the first problem I would right click on your solution, go to Configuration Properties and ensure that all of the correct projects are being built and that your android project's Deploy box is checked. This is just a bad Xamarin tendency.
I have the second warning myself and it is simply because the Android Support Library requires you to compile against sdk version 23. The Google maps package must use these new annotations. I haven't encountered any problems because of this error, with a minSdkVersion of 15, so I just live with it.
I also have the same dependent assembly warning and what I think is happening is I have one project which is using a newer reference to .net primitives than whatever .net http is using. Just a guess but I am also not worried about making this happy.
All,
I am attempting to use an existing open-source project (we'll call it A) within my app as a library. Project A also comes with its own library project (B). Project A compiles and runs just fine; however, when I try to use A within my app (I checked the 'Is Library' within A and added A to my app) I get several errors that "No resource identifier found for attribute 'X'in package..." These particular attributes exist within B. I even checked that they were added to R within A, and in fact, they were.
My question: why doesn't my app see that these resources exist?
I've searched all over and found only one situation like mine:
Android library not pulling its resources through to other projects
but I do not see that any of my resources are named the same.
I'm using Eclipse with ADT v20.0
I appreciate any help!
EDIT: If it's helpful, the open-source app I'm trying use is AnySoftKeyboard (ASK). I've also tried creating a new project and adding ASK as a library -- no dice.
EDIT2: Part of making ASK a library required converting several switch statements to if-else statements because R Ids are not declared as final for libraries.
The errors are apparently due to the usage of custom attributes in the AnySoftKeyboard project that you converted to a library. I found that a solution is recently added into ADT (on Rev 17), mentioned in this answer.
As instructed, I tried replacing all instances of
"http://schemas.android.com/apk/res/com.menny.android.anysoftkeyboard"
with
"http://schemas.android.com/apk/res-auto"
in the newly converted library project and was able to build and run an app which includes the project (didn't really test any functionality though).
Hope this helps.
this is a copy of my question on Pubnub support page:
Hi all, I tried running the PubnubTestApp that is downloadable with the Pubnub API from your git repo.
but when I try and start the test app i firstly get a build path error because apparently you (pubnub guys) have configured the project to look for 2 jar files that don't exist. (bcprov-jdk16-145.jar and commons-codec-1.2.jar).
after I removed those 2 references the project showed no error. but when I tried running it, it crashed again with this error:
"07-04 12:29:11.782: E/AndroidRuntime(754): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.fbt/com.fbt.PubNubTestActivity}: java.lang.ClassNotFoundException: com.fbt.PubNubTestActivity in loader dalvik.system.PathClassLoader[/data/app/com.fbt-1.apk"
after looking over the internet for the reasons for this crash, I noticed that in the manifest.xml file in the project there is a mistake in the name of the activity name. (it's named ".PubNubTestActivity" instead of ".PubnubTestActivity").
after changing the manifest, everything works and the app will install and run but there a a few problems still.
when pressing the "publish" button or the "history" button the app crashes and dies automatically. also it crashed without any clicking of anything (just like that).
here are the crash reports I got from the emulator.
http://pastie.org/private/pojnpnxmznvn9azdg7uyg
apparently the project doesn't recognize the "pubnub.crypto" jar file even though I (and you) added it to the build path and made sure it's in the project.
please let me know how to fix this so I can use (at last) pubnub in my app.
Have you tried the latest build? This should be fixed now.
I have several Android projects in an Eclipse workspace:
a stand-alone application project with a class my.package.Foo
a library project with a different class my.package.Foo
two application projects that depend on the library project and contain no source code
The problem comes when working with one of the applications built on top of the library project. When it crashes (sadly, a frequent occurrence), I double-click on a line of the stack trace in the logcat to go to the relevant source. The problem is, if the line is for Foo.java, Eclipse always opens the source from the stand-alone project. The only way I can direct Eclipse to the right source is to close the stand-alone project, which is somewhat inconvenient.
Is there any way to get Eclipse to pay attention to which application actually crashed when it looks for the relevant source file? I assume that this is some sort of classpath problem (similar to that described in this post). However, I don't see anything in the Android run configuration properties for modifying the class path. Eclipse always seems to run through the workspace projects in alphabetical order by name and opens the first my/package/Foo.java it finds.
I'm using the latest Android ADT and SDK versions.
Per the link provided in the comment by #blessenm, this is an issue with logcat in Eclipse. We should see a fix in Release 20 of the SDK tools. As can be seen here, the patch that fixes it has been completed and is in line for final approval.
Meanwhile, the best thing to do is to change the logcat preferences (Window -> Preferences -> Android -> LogCat) so that the double-click action is "Go to Problem (method declaration)" instead of the default "Go to Problem (error line)". This isn't foolproof: it will at least open the file but if there are multiple methods with the same name, it will go to the first method, regardless of signature. (When the fix is incorporated, there will be no need for options for double-click action and it should disappear from the preferences.)