I'm trying to import actionbarcherlok project inside my project (actionbarsherlok is a project marked with "is library")
My project includes yet support-v4 library, so when I import sherlock action bar (that also includes support-v4 library) I obtains the following error:
Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
That means I have to remove one library.
I have removed the support-v4 library that was already in my project, but I obratin an error at this line
public class ReminderCreation extends FragmentActivity{
because FragmentActivity was taken from support-v4 library:
android.support.v4.app.FragmentActivity
I can I solve this problem? Can I refer to the support-v4 library included in the sherlock project?
NOTE:
I have also tryied changing FramentActivity into SherlokFragmentactivity, obtaining this error:
The hierarchy of the type ReminderCreation is inconsistent.
EDIT:
If I introduce this modification (suggested by #ascorbin) and I otain this error at runtime:
10-17 09:30:12.190: E/dalvikvm(1877): Could not find class 'com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder', referenced from method host.framework.ApplicationFramework.onCreate
10-17 09:30:12.190: W/dalvikvm(1877): VFY: unable to resolve new-instance 489 (Lcom/nostra13/universalimageloader/core/ImageLoaderConfiguration$Builder;) in Lhost/framework/ApplicationFramework;
10-17 09:30:12.190: E/AndroidRuntime(1877): FATAL EXCEPTION: main
10-17 09:30:12.190: E/AndroidRuntime(1877): java.lang.NoClassDefFoundError: com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder
at this line:
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
inside a class that extends Application
(I have never get this error before)
The error didn't mean that you had to delete one support-jar but that they all have to be the same version. Delete the support library from both projects, then right-click -> android -> add support library for both, then they'll both have the same jar.
Related
I'm using google's grpc library in my android app which relies on the google guava library. For some reason the guava embedded in grpc doesn't have 'directExecutor' method in the class MoreExecutors. But the method is present in the github version? What accounts for the discrepancy?
In a class called ClientCallImpl is where the call to directExecutor is made. On the import statement(import static com.google.common.util.concurrent.MoreExecutors.directExecutor;) AndroidStudio shows a can't resolve symbol message, but the build doesn't fail. The exception is raised when the call is made during execution.
Error Message
FATAL EXCEPTION: SyncAdapterThread-1
Process: com.asdf.asdf, PID: 4025
java.lang.NoSuchMethodError: No static method directExecutor()Ljava/util/concurrent/Executor; in class Lcom/google/common/util/concurrent/MoreExecutors; or its super classes (declaration of 'com.google.common.util.concurrent.MoreExecutors' appears in /data/data/com.fentale.dalol/files/instant-run/dex/slice-guava-jdk5-17.0_a8ada10dcaf113cb6e3b4d3e5b46975833f8ae8f-classes.dex)
at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:100)
at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:320)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:299)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:130)
at com.fentale.dalol.nano.DalolGrpc$DalolBlockingStub.topPosts(DalolGrpc.java:365)
EDIT
It seems the problem is that my project has dependencies on both guava-18.0 and guava-jdk5-17.0. The method I want directExecutor is only defined in the MoreExecutors class of guava-18, not 17. But the code is looking for it in the latter version of the class. How can I resolve this.
My app had a dependency on the youtube library which inturn depended on guava. However youtube's guava dependency is from a different source than grpc's and using an older version. Two versions of the guava jar existed in the app and grpc was accessing youtube's older guava version rather than its own, which caused the problem.
compile('com.google.apis:google-api-services-youtube:v3-rev164-1.21.0') {
exclude module: 'guava-jdk5'
}
I have a Unity game which uses an Android Library packed in an AAR (library.aar). However, I need to access the Main Activity's lifecycle callbacks (onPause(), onResume(), to name a few).
So I created a new library project in Android Studio (let's call this plugin). I imported library.aar into plugin and added it to the Dependencies. I tested it by calling the functions inside library.aar inside MainActivity. It doesn't throw any errors at this point.
In MainActivity, I called Library.onActivityResult(), Library.onResume(), and Library.onPause() in the respective functions.
Next, I added the classes.jar from Unity/Editor/Data/PlaybackEngines/androidplayer/release/bin into my plugin project. I added the JAR into the dependencies. I tested it by trying to subclass UnityPlayerActivity. Again, no errors yet.
I compile plugin into plugin-debug.aar and put it in Assets/Plugins/Android. I also created an AndroidManifest.xml which I got from the Unity Manual and put it inside Assets/Plugins.
I call the functions from a button in a Unity scene like so:
AndroidJavaClass jc = new AndroidJavaClass("com.alxcyl.plugin.MainActivity");
jc.CallStatic("connect");
// "connect" is a static function in the Java class MainActivity containing
// a short message like so:
// Log.d("My Plugin", "connect() was called");
I build the game and run it on my Android device. If I click the button, MyPlugin.connect() is properly called since it logs the message it's supposed to when clicked.
I think the lifecycle callbacks are properly called but the problem is that it logs an error saying:
I/dalvikvm( 5466): Could not find method com.somecompany.library.Library.onActivityResult, referenced from method com.alxcyl.plugin.MainActivity.onActivityResult
W/dalvikvm( 5466): VFY: unable to resolve virtual method 276: Lcom/somecompany/library/Library;.onActivityResult (IILandroid/content/Intent;)V
I/dalvikvm( 5466): Could not find method com.somecompany.library.Library.onPause, referenced from method com.alxcyl.plugin.MainActivity.onPause
W/dalvikvm( 5466): VFY: unable to resolve virtual method 276: Lcom/somecompany/library/Library;.onPause()V
I/dalvikvm( 5466): Could not find method com.somecompany.library.Library.onResume, referenced from method com.alxcyl.plugin.MainActivity.onResume
W/dalvikvm( 5466): VFY: unable to resolve virtual method 276: Lcom/somecompany/library/Library;.onResume()V
D/MyPlugin( 5466): connect() was called
I'm not sure what causes it. When you build the plugin project, it builds fine without any errors but when you access it through Unity, it doesn't work. I tried to use the same library.aar into a new Android project and Library.onActivityResult(), Library.onPause(), and Library.onResume() definitely exists and are properly called.
Could it be that Unity can't handle AARs that include AARs? Is there a fix for this?
Looks like the .jar file with all your compiled code is missing in the .aar library.
Unity compiles its own .jar file with all .jar files from all plugins together, into one .dex file.
On Unity forums, you posted "class not found" error; here you mention "method not found". Anyway, something seems to be wrong with your .aar file.
I'm having an issue with IntelliJ's dependency handling in regards to external modules. Here's some context:
I'm writing an Android app which implements Google Maps. For my current feature set, I require two external libraries-- Google's Play Services Library and mapex (A third party google map extension library located here https://code.google.com/p/mapex/). I actually built most of this project in Android Studio before I was recommended to move to IntelliJ due to the easier dependency handling. But now I'm here and still having problems.
My Error
When trying to build an object from a class located in the mapex package (com.androidnatic.maps), I get this error when starting the activity the view is contained in (object has not been created yet):
07-03 11:40:35.837: ERROR/dalvikvm(3585): Could not find class 'com.androidnatic.maps.SimpleMapView', referenced from method com.example.myproject.MapActivity.showHeatMap
And then, upon creation, my app force closes and leaves this behind in logcat:
7-03 11:40:45.467: ERROR/AndroidRuntime(3585): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.androidnatic.maps.SimpleMapView
at com.example.myproject.MapActivity.showHeatMap(MapActivity.java:492)
Yet I'm completely stumped because my IDE gives me no sign that anything is wrong! Classes are auto-filled in when trying to access them from MyProject.
ide-fill-in http://www.tonyandrys.com/img/fillin.jpg
No build errors about missing classes, missing modules, class definitions, or anything related.
I get the same results if I try to access the class via its full package name as well.
// No dice.
final SimpleMapView mapView = new SimpleMapView(this, "apikey");
final com.androidnatic.maps.SimpleMapView mapView = new com.androidnatic.maps.SimpleMapView(this, "apikey");
It seems that there's only an issue when the application is running on my phone, as far as my IDE is concerned.
Here's the structure of MyProject:
main-project-structure http://www.tonyandrys.com/img/mainstructure.jpg
Here's my main project's dependency settings (where I assume I screwed up somewhere):
project-structure http://www.tonyandrys.com/img/projectstructure.jpg
And here is the structure of the mapex library module:
mapex-lib http://www.tonyandrys.com/img/mapexstructure.jpg
The class files that I'm trying to access live in MapExLib/gen and MapExLib/src, which are currently marked as source directories (blue).
Does anyone have any ideas on how to proceed from here?
Try to do this :
Android, IntelliJ Idea, changing module type
I had the same error "Could not find class XXX from referenced method XXX" with Intellij, involving an Android Test Module and a test which could not find the Activity class anywhere.
I set inside the Project Structure the main Module's Facet Android to Library Module (checkbox) and it worked...
Let us know
I have a problem with the new ActionBarSherlock.
I have to link it to my project and use it's features (Fragments, etc), in a project that supports android API level 7 and above.
I have created a module in intelij with my project, and I've linked the ActionBarSherlock library project to it. Everything looks good, the project rebuilds correctly, deploy a valid apk to emulator, but when I'm trying to run the application I got something like this:
WARN/dalvikvm(540): Unable to resolve superclass of Lcom/mobileinsight/common/CustomActivity; (134)
WARN/dalvikvm(540): Link of class 'Lcom/mobileinsight/common/CustomActivity;' failed
WARN/dalvikvm(540): Unable to resolve superclass of Lcom/mobileinsight/ui/SplashActivity; (175)
WARN/dalvikvm(540): Link of class 'Lcom/mobileinsight/ui/SplashActivity;' failed
WARN/dalvikvm(540): threadid=3: thread exiting with uncaught exception (group=0x4001b188)`
ERROR/AndroidRuntime(540): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mobileinsight/com.mobileinsight.ui.SplashActivity}: java.lang.ClassNotFoundException: com.mobileinsight.ui.SplashActivity in loader dalvik.system.PathClassLoader#45f352e8
I get the error when the application tries to instantiate an activity that extends SherlockActivity or FragmentSherlockActivity
Somebody can help me with this?
Thanks,
Ark
I'm trying to replicate this class called MediaMetadataRetriever in my own android project. You can see the class here:
https://android.googlesource.com/platform/frameworks/base/+/master/media/java/android/media/MediaMetadataRetriever.java
In line # 40 you can see: System.loadLibrary("media_jni");
How do I get that library? My logcat shows this:
Caused by: java.lang.UnsatisfiedLinkError: Library media_jni not found
This is a JNI class, which is created in C/C++ and included as a SO in your app. The class is loaded during runtime.
Look here https://android.googlesource.com/platform/frameworks/base/+/master/media/jni