I created a project in android studio and I did not put a code on it. But when I try to install it on my cellphone jelly bean(4.2.2) version. It returns "Exception while inflating ".
I got this error
08-04 15:18:38.377 15045-15045/? E/VdcInflateDelegate﹕ Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:708)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:348)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:689)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:83)
at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:193)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
at dunhill.diary_sarah.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:5326)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
I'm tried to add "vectorDrawables.useSupportLibrary = true" on android default config but still not working. also put this code on build.gradle. "generatedDensities = []" and "aaptOptions { additionalParameters "--no-version-vectors" }". I got this error "Error:(13, 0) No such property: generatedDensities for class: com.android.build.gradle.internal.dsl.ProductFlavor_Decorated"
I'm tried to add "vectorDrawables.useSupportLibrary = true"
In order to use it, you need at lease version 2 of the android gradle plugin. At the moment you are using 1.3. You should also avoid mixing versions when it comes to compileSdkVersion, buildToolsVersions and support library.
I changed compile 'com.android.support:appcompat-v7:24.1.1' to compile 'com.android.support:appcompat-v7:23.2.1' and it's working now.
Related
I want to use Algolia in my app for geo search.
When I copy the sample project(icebnb) files to my project.
I already cleared some error bug from instant search module by the help of stack overflow helpers.
It raises an error when I open the activity (runtime).
I am facing this error and suffering from long time. Please help me.
09-27 14:44:57.244 29793-29793/com.google.tho.saw E/AndroidRuntime: FATAL EXCEPTION: main java.lang.ExceptionInInitializerError
at com.jayway.jsonpath.internal.ParseContextImpl.parse(ParseContextImpl.java:38)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:502)
at com.algolia.instantsearch.utils.JSONUtils.getObjectFromJSONPath(JSONUtils.java:40)
at com.algolia.instantsearch.utils.JSONUtils.getStringFromJSONPath(JSONUtils.java:22)
at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:458)
at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:398)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1618)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4702)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at com.jayway.jsonpath.internal.JsonContext.<clinit>(JsonContext.java:41)
at com.jayway.jsonpath.internal.ParseContextImpl.parse(ParseContextImpl.java:38)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:502)
at com.algolia.instantsearch.utils.JSONUtils.getObjectFromJSONPath(JSONUtils.java:40)
at com.algolia.instantsearch.utils.JSONUtils.getStringFromJSONPath(JSONUtils.java:22)
at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:458)
at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:398)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1618)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4702)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
You are missing library for class org.slf4j.LoggerFactory.
Try adding following depending in your app/build.gradle file.
compile 'org.slf4j:slf4j-api:1.7.24'
compile 'org.slf4j:slf4j-simple:1.7.24'
OR
You can also download slf4j jar file and then include in app/build.gradle as:
compile files('libs/slf4j.jar'); //You can change jar name here
What version of InstantSearch Android/IceBNB are you using?
Running the current version of IceBNB works as expected, the only way I can reproduce your situation is by manually removing SLF4J from InstantSearch:
compile ("com.algolia:instantsearch-android:$VERSION_INSTANTSEARCH") {
exclude group: "org.slf4j"
}
This would trigger the java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory that you report. But unless you do remove SLF4J manually, you should not need anything to have the example apps working.
The accepted answer's suggestion only makes sense if you had removed SLF4J in the first place.
Can you share a setup which triggers the error?
I update android-studio 3.0 from canary 5 to canary 6 and suddenly My app gives crash on KitKat(API 19) with below stacktrace.
The Main2Activity.java:10 line is the first line in my activity onCreate() method.
07-11 13:00:39.523 8913-8913/dcpl.com.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: dcpl.com.myapplication, PID: 8913
java.lang.RuntimeException: Unable to start activity ComponentInfo{dcpl.com.myapplication/dcpl.com.myapplication.Main2Activity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f070058
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f070058
at android.content.res.Resources.getValue(Resources.java:1173)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:332)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:197)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:711)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:131)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:155)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:31)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:55)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at dcpl.com.myapplication.Main2Activity.onCreate(Main2Activity.java:10)
at android.app.Activity.performCreate(Activity.java:5411)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
at dalvik.system.NativeStart.main(Native Method)
How can I solve it?
Seems like the issue is related to Aapt 2.
Put
android.enableAapt2=false
In your gradle.properties file and it fixes the issue for me.
I have the same issue.
put
android.enableAapt2=false
AAPT2. We are continuing to stabilize AAPT2 which enables incremental resource processing. If your build fails due to resource processing issue, please send us a bug report. To temporarily disable AAPT, set android.enableAapt2=false in your gradle.properties file.
Roboelectric is currently not compatible with AAPT2
follow the below link
https://androidstudio.googleblog.com/2017/06/android-studio-30-canary-5-is-now.html
I had the same problem. To solve it, just update to Android Studio 3.0 Canary 7.
Fixes:
63623801 ResourceNotFoundException running Kotlin project on API 16 AVD after upgrading to Canary 6
Release notes
add this code in my project
android.enableAapt2=false
solved one of my issues: with Android Studio 3.0 : canary 6, Gen a signed APK by default which can't parsered by "AXmlResourceParser.java"(axmlprinter2-2.0.jar)
I'm building LatinIME source code provided by google-source in android-studio but i got a bug in ProximityInfo.java line 89 which show a dialog and i have added a jni_latinime.so
in src/main/jniLibs
.
But the bug is still not fixed.What mistake i did and what should i have to do now?
Error
droid.inputmethod.latin E/JniUtils: Could not load native library jni_latinime
java.lang.UnsatisfiedLinkError: unknown failure
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at com.android.inputmethod.latin.utils.JniUtils.<clinit>(JniUtils.java:28)
at com.android.inputmethod.latin.LatinIME.<clinit>(LatinIME.java:546)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2406)
at android.app.ActivityThread.access$1700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
05-28 21:58:48.483 1642-1957/system_process E/InputMethodManagerService: checkCscDefaultIme : mCscDefaultImePackageName is wrong
05-28 21:58:48.493 1642-1957/system_process E/InputMethodManagerService: checkCscDefaultIme : mCscDefaultImePackageName is wrong
05-28 21:58:48.834 12819-12819/com.android.inputmethod.latin E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.android.inputmethod.compat.UserManagerCompatUtils.<clinit>
05-28 21:58:48.844 12819-12819/com.android.inputmethod.latin E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.android.inputmethod.compat.UserManagerCompatUtils.getUserLockState
05-28 21:58:48.954 12819-12819/com.android.inputmethod.latin E/AndroidRuntime: FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #2: Error inflating class com.android.inputmethod.keyboard.emoji.EmojiPalettesView
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:593)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Native method not found: com.android.inputmethod.keyboard.ProximityInfo.setProximityInfoNative:(IIIIII[II[I[I[I[I[I[F[F[F)J
at com.android.inputmethod.keyboard.ProximityInfo.setProximityInfoNative(Native Method)
at com.android.inputmethod.keyboard.ProximityInfo.createNativeProximityInfo(ProximityInfo.java:222)
at com.android.inputmethod.keyboard.ProximityInfo.<init>(ProximityInfo.java:81)
at com.android.inputmethod.keyboard.Keyboard.<init>(Keyboard.java:123)
at com.android.inputmethod.keyboard.internal.KeyboardBuilder.build(KeyboardBuilder.java:196)
at com.android.inputmethod.keyboard.KeyboardLayoutSet.getKeyboard(KeyboardLayoutSet.java:232)
at com.android.inputmethod.keyboard.KeyboardLayoutSet.getKeyboard(KeyboardLayoutSet.java:204)
at com.android.inputmethod.keyboard.emoji.EmojiCategory.getKeyboard(EmojiCategory.java:374)
at com.android.inputmethod.keyboard.emoji.EmojiCategory.addShownCategoryId(EmojiCategory.java:223)
at com.android.inputmethod.keyboard.emoji.EmojiCategory.<init>(EmojiCategory.java:176)
at com.android.inputmethod.keyboard.emoji.EmojiPalettesView.<init>(EmojiPalettesView.java:120)
at com.android.inputmethod.keyboard.emoji.EmojiPalettesView.<init>(EmojiPalettesView.java:96)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:593)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Your screenshot suggests that your jniLibs contains a jar file with prebuilt native library. I did not know that this is even possible, but yes, it works in Android Studio 2.3 and higher. Nice!
Anyways, as I explained elsewhere, don't expect Android Studio to resolve magically the native method declarations into a prebuilt library (even if it is unpacked into src/main/jnLibs).
You can simply ignore this error message: your APK will still install the prebuilt library, and the native method will be resolved at run time.
You can add #SuppressWarnings("JniMissingFunction") annotation for this method, or for the entire class:
#SuppressWarnings("JniMissingFunction")
public class ProximityInfo {
or configure this kind of Lint inspections for the given project, or for all projects:
This is very old query and hopefully must have been solved by now. But still wanted to put my comment on this.
As I can see this is a run time error and related to "UnsatisfiedLinkError", which means that the application is unable to link to the library that it is looking for. Hence the library "latimime" is missing when the application is bundled.
To make sure that the library is bundled along with the application, you can extract the APK and check.
I use version of Android Studio 1.5.1
If I create new project and MainActivity extends AppCompatActivity then it does not work it gives error like:
12-02 11:55:20.736 29178-29214/? E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
12-02 11:55:45.099 29225-29225/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.poonam.demoappcompatactivity/com.example.poonam.demoappcompatactivity.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:726)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.example.poonam.demoappcompatactivity.MainActivity.onCreate(MainActivity.java:10)
at android.app.Activity.performCreate(Activity.java:4479)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)
12-02 11:55:48.855 233-4816/? E/CellLocation: create GsmCellLocation
I create new project. Not change anything only run it.but it gives error.
How can i use AppCompatActivity.
Your logcat throws
This app has been built with an incorrect configuration.
You should use latest gradle plagin version
classpath 'com.android.tools.build:gradle:2.2.2' //2.2.0
Here is Demo
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
FYI
You can add this in your build.gradle section .
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
Then Clean-Rebuild, Sync & Run.
I have put the admob .jar file in my project via project structure:
And I added code in for the admob banner into my layout files:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e5e5e5"
android:orientation="vertical" >
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="taken out for stack"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
<ListView
android:id="#+id/yourTasteStatistics"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:dividerHeight="0px"
android:divider="#null"
>
</ListView>
</LinearLayout>
But when I open a fragment with an ad on it, my app automatically crashes...Any ideas what step I must be missing here?
Here is the output:
05-13 17:56:44.053 12606-12606/com.beerportfolio.freeBP E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.beerportfolio.freeBP, PID: 12606
android.view.InflateException: Binary XML file line #14: Error inflating class com.google.ads.AdView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.beerportfolio.freeBP.BeerPage.onCreateView(BeerPage.java:30)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1097)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1895)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1514)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:958)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.ads.AdView" on path: DexPathList[[zip file "/data/app/com.beerportfolio.freeBP-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.beerportfolio.freeBP-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at android.view.LayoutInflater.createView(LayoutInflater.java)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.beerportfolio.freeBP.BeerPage.onCreateView(BeerPage.java:30)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1097)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1895)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1514)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:958)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(Native Method)
Line 30 is just where the fragments view is inflated. Make sense its crashing there if it does not like my admob ads.
Update:
As noted in the comments I was using out of date libs. I then followed this link for instructions on how to update to use google play services instead.
https://developer.android.com/google/play-services/setup.html?hl=pt-br
My problem is here on this step:
apply plugin: 'android'
...
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.3.23'
}
When I add that to my grade the gradle fails to sync. My grade looks like this now:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
compile 'com.google.android.gms:play-services:4.3.23'
}
}
allprojects {
repositories {
mavenCentral()
}
}
And give me this error:
Error:(9, 0) Build script error, unsupported Gradle DSL method found: 'compile()'!
Possible causes could be:
- you are using Gradle version where the method is absent (Fix Gradle settings)
- you didn't apply Gradle plugin which provides the method (Apply Gradle plugin)
- or there is a mistake in a build script (Goto source)
Your dependencies block is in the wrong place. It looks like you edited build.gradle in your top level directory.
Open the one in your application module instead. There should be an android block there etc. Or just use the project structure dialog in android studio to edit it.