Although the same question was asked several times i didnt manage to fix my problem. It has been months since i try to find a solution. Iam using latest Android SDK with latest Google Play Servises v5.0.89....
Images:
Properties:
Build Path:
Proguard:
Activity.Java:
Manifest:
Activity.Xml:
are you testing on device or emulator ? In your first screenshot (properties), you seem to have picked generic target, try with google api target as shown below:
Also, i notice you have 2 compat libraries in build path...i would pick one.
Please see this sample , i was able to quickly test it on emulator:
Related
I have a jar built using maven. The project from which the jar was build has no native dependencies. It runs fine in all devices except few devices having android 4.4.2 and 4.4.4. Can someone help me with this, right now my option is to disable the feature for all devices below 5.0
Edit 1:
Debugging further I found that the LazyHolder implementation of my singleton class is failing as in runtime the constructor is unable to resolve the static class.
Caused by java.lang.UnsatisfiedLinkError: <muted>
at com.a.b.controller.Controller.getInstance + 31(Controller.java:31)
at com.a.b.controller.Controller.k + 184(Controller.java:184)
at com.a.b.core.parser.f.m + 53(ff.java:53)
at com.a.b.core.parser.f.n + 67(f.java:67)
at a.b.c.d.e$classify$$inlined$use$lambda$1.invokeSuspend(e.java:90)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith + 32(BaseContinuationImpl.java:32)
at kotlinx.coroutines.DispatchedTask.run + 233(DispatchedTask.java:233)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely + 594(CoroutineScheduler.java:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$getSchedulerName$p + 60(CoroutineScheduler.java:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run + 742(CoroutineScheduler.java:742)
Edit 2:
I created a fix by passing in the android version into my jar and then not using LazyHolder for versions less than 4.4.* or lesser. Feel free to suggest better solutions.
I have waited for a while now to get an appropriate answer to this question. Unfortunately, this is not easy to reproduce and might be a corner scenario as most android developers are not concerned about version 4 or less. So I have decided to put all my findings as an answer to this question.
In my scenario, I had LazyHolder(https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom) implementation for initializing my central object. But the problem was when ran on Android 4.4.* devices the lazy-holder failed to get the static class. The class was not available at runtime. I ran the app in debug mode on an android 4.4.2 device and was able to clearly pinpoint this.
Reading further, I found that the static class is probably getting into another dex file while my constructor in one altogether a different one(this is pretty common when multiDex was enabled in 4.4.* it seems).
Finally, the hack was to initialize normally in case of android version less than 5 and with lazy-holder if it's above 5
I wanted to start developing for the Sony Smartwatch 2 I just got.
This is where the problems started. I found many official articles about downloading and setting up the Sony Add-on SDK.
But here's the dark side:
It is not available anymore from Sony's dev site, so I could not add it by using the Android SDK manager .
After lots of sweat I managed to find it only here.
Which is the 2.0 version.
I unzipped it into my /[SDK]/add-ons/sony_add-on_sdk_2_0 folder, and set up Eclipse (4.6.3) with the following SDK manager settings:
SDK settings
First it reported the Sony SDK broken, but I found in another topic that I should add a source.properties file, in order to make it work, which has the following header:
### Android Tool: Source of this archive.
#Wed Feb 28 14:14:39 CET 2018
Addon.NameDisplay=SONY ADD-On SDK
Addon.NameId=sony_add_on
Addon.VendorDisplay=SONY
Addon.VendorId=sony
AndroidVersion.ApiLevel=16
Pkg.Desc=Android + Google APIs
Then it became visible for the Eclipse
When I try to build the SamplePreferenceActivity it is imported with SmartExtensionsAPI and SmartExtensionsUtils but one after the other as I read this can make errors too, in the following order:
API
Utils
Sample
which has the following properties:
Properties for SmartExtensionAPI
Properties for SmartExtensionUtils
With these settings I still get error in:
/SmartExtensionUtils/src/com/sonyericsson/extras/liveware/extension/util/widget/NotificationWidgetExtension.java
saying
SmartWatchNotificationWidgetImage cannot be resolved to a type
and in
/SamplePreferenceActivity/res/layout/item_gallery.xml
saying:
Couldn't resolve resource #style/Widget.Holo.ActionMode Couldn't
resolve resource #dimen/smart_watch_2_control_width You must supply a
layout_width attribute. Couldn't resolve resource
#dimen/smart_watch_2_text_size_large
"#dimen/smart_watch_2_text_size_large" in attribute "textSize" is not
a valid format. Couldn't resolve resource
#dimen/smart_watch_2_text_size_medium
"#dimen/smart_watch_2_text_size_medium" in attribute "textSize" is not
a valid format.
What am I missing here? Should I use a completely different setup? Is this because I had to manually add the SDK to Eclipse? If you need anything else to understand the problem properly, feel free to ask me, thanks for helping me!
I am trying to create a line graph. I found a tutorial from the following site which I have been following:
https://github.com/PhilJay/MPAndroidChart/wiki/Setting-Data
The problem I am having is with this line of code:
List<ILineDataSet> dataSets = new ArrayList<>();
Android studio does not seem to recognize the type "ILineDataSet" and as a result is preventing me from proceeding any further in completing this task.
It has offered solutions to resolve it, which are:
Create Class
Create Enum
Create Inner Class
Create Interface
All of which I do not think will solve the issue as I assume the library has already configured this but for some reason its not being picked up by android studio.
Could someone direct me as to how I can resolve this issue?
Thanks!
I'm so stupid.
Library wasnt updated.
Please ignore this
I was going to ask if you added:
dependencies {
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
}
To your gradle.build
I just installed Android Studio and whenever I start a project (even the default "Hello world" activity created by the IDE).
I have this exception which is raised :
java.lang.ClassNotFoundException: Didn't find class
"android.widget.ViewStub" on path: DexPathList[[zip file
"/data/app/com.example.noname.exceptiontest-2/base.apk"],nativeLibraryDirectories=[/vendor/lib
/system/lib]]
I wished I had some logcat to show but it doesn't seems like this exception is logged in it.
It doesn't stop the project or any other project that I have from working, just a little bit frustrating to go through the stack of this exception every time I run my projects in debug.
After looking around the Internet it doesn't seem that that many people have this problem, only answer that would match my issue would be a problem with Android studio. However those answers dated from more than one year.
I just changed my computer and wanted to move from Eclipse to Android Studio to do some development on my free time. I don't have access to my previous environment for the moment to try to install Android studio and reproduce that error.
Does anyone have or already had this error ? (To reproduce New Hello world Activity, activate any exception in Android Studio and run in debug)
Cheers
If you are getting this exception because you have set exception breakpoint, then instead of debugging, remove all breakpoints, just run the code,go to logcat and check the logs for the actual exception.
You could be trying to access a nested component like button from the grandparent and therefore the error.
ViewStub lays in a package called android.view, not android.widget. Change the import directive and see if it helps.
Old question, but I had this same issue with Android Studio 2.3
With a project that had 4 modules, the trouble was that I had a misspelling in one of the gradle.build files for one of the modules in the applicationId value.
defaultConfig {
applicationId "com.my.project"
}
After fixing this, and verifying all of the AndroidManifest.xml values for package matched the build.gradle value above within each module, it worked.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.project">
</manifest>
You may also need to go to File > Invalidate Caches / Restart... to clean it all out.
the method findClass(String name) of the classLoader that defined by yourself don't throws ClassNotFoundException.
I am currently developing an Android app using cordova 2.0. Obviously the plugins.xml has been depreciated and everything is now housed in config.xml. I was just wondering if anyone has managed to get the Phonegap Screenshot plugin working in Eclipse and Cordova 2.0 working on android.
Plugin can be found:
https://github.com/josemando/phonegap-plugins/tree/master/Android/Screenshot
I have added:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
to my Android manifest xml. And made sure that:
<plugin name="Screenshot" value="org.apache.cordova.Screenshot"/>
is added to my config.xml (that now contains all plugin information from plugin.xml)
Screenshot.js is added to the directory:
assets/www/js/
However I am unsure where exactly to place the Screenshot.java file. The example has it in:
src / org / apache / cordova /
However as I did not have this directory I simply placed it in:
src/uk.co..appname1.appname2/
When I did this however it produced errors, the first one being:
The declared package "org.apache.cordova" does not match the expected package "uk.co.mysitename.appname1.appname2" Screenshot.java /Project Name/src/uk/co/mysitename/appname1/appname2line 8 Java Problem
This refers to this line in the Screenshot.js:
package org.apache.cordova;
The two suggested actions to fix this are to:
Move 'Screenshot.java' to package 'org.apache.cordova' (this directory doesn't exsist atm)
Or change package directory to 'uk.co.mysitename.appname1.appname2'
The second error says:
The method run() of type new Runnable(){} must override a superclass method
The suggested action for this being to "remove '#override' annotation"
I have tried to do every possible combination of these however I cannot seem to make progress and get it all to link up. Usually because it thinks that CordovaRef isn't referenced. I am unsure if the plugin even works on Cordova 2.0.0. I have some experience with Phonegap/Cordova but only in ios with Xcode and Objective C plugins. I am new to Java, Eclipse and Android. Any help or clarification on any of these matters would be greatly appreciated.
Answer resolved by:
Phonegap Screenshot plugin in Cordova 2.0.0
Answer/solution provided by Simon MacDonald