LINUX.ORG.RU

Можно ли понять по этим ошибкам что не так?

 ,


0

1

Пишу утилиту на java для android, как только запускается программа, то тут же завершается. В логах подсвечена строка, а именно

        setContentView(R.layout.activity_main);
Это что значит, что я в разметке что не так сделал?

03-08 23:02:18.804 29685-29685/com.xverizex.upnp_ip_route I/InstantRun: starting instant run server: is main process
03-08 23:02:18.904 29685-29685/com.xverizex.upnp_ip_route W/linker: libnative-lib.so: unused DT entry: type 0x6ffffffe arg 0x28e0
03-08 23:02:18.904 29685-29685/com.xverizex.upnp_ip_route W/linker: libnative-lib.so: unused DT entry: type 0x6fffffff arg 0x1
03-08 23:02:18.974 29685-29700/com.xverizex.upnp_ip_route W/art: Suspending all threads took: 47.454ms
03-08 23:02:18.974 29685-29700/com.xverizex.upnp_ip_route I/art: Background partial concurrent mark sweep GC freed 180(33KB) AllocSpace objects, 0(0B) LOS objects, 45% free, 623KB/1135KB, paused 48.706ms total 71.136ms
03-08 23:02:18.984 29685-29685/com.xverizex.upnp_ip_route V/Activity: calling onCraete for activity: com.xverizex.upnp_ip_route
03-08 23:02:19.034 29685-29685/com.xverizex.upnp_ip_route W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-08 23:02:19.234 29685-29700/com.xverizex.upnp_ip_route W/art: Suspending all threads took: 27.343ms
03-08 23:02:19.234 29685-29700/com.xverizex.upnp_ip_route I/art: Background partial concurrent mark sweep GC freed 242(102KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 1086KB/1598KB, paused 28.808ms total 62.408ms
03-08 23:02:19.344 29685-29685/com.xverizex.upnp_ip_route D/AndroidRuntime: Shutting down VM
03-08 23:02:19.344 29685-29685/com.xverizex.upnp_ip_route E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: com.xverizex.upnp_ip_route, PID: 29685
                                                                            java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.xverizex.upnp_ip_route-1/split_lib_dependencies_apk.apk)
                                                                                at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
                                                                                at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
                                                                                at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110)
                                                                                at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
                                                                                at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:81)
                                                                                at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:71)
                                                                                at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:67)
                                                                                at android.support.v7.widget.Toolbar.setTitle(Toolbar.java:753)
                                                                                at android.support.v7.widget.ToolbarWidgetWrapper.setTitleInt(ToolbarWidgetWrapper.java:261)
                                                                                at android.support.v7.widget.ToolbarWidgetWrapper.setWindowTitle(ToolbarWidgetWrapper.java:243)
                                                                                at android.support.v7.widget.ActionBarOverlayLayout.setWindowTitle(ActionBarOverlayLayout.java:621)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.onTitleChanged(AppCompatDelegateImplV9.java:631)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                                                at com.xverizex.upnp_ip_route.MainActivity.onCreate(MainActivity.java:62)
                                                                                at android.app.Activity.performCreate(Activity.java:6012)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
                                                                                at android.app.ActivityThread.access$800(ActivityThread.java:151)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:135)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5348)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
03-08 23:02:21.206 29685-29685/com.xverizex.upnp_ip_route I/Process: Sending signal. PID: 29685 SIG: 9

java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.xverizex.upnp_ip_route-1/split_lib_dependencies_apk.apk)
Deleted ()

ошибка была вот в чём. Я использовал sdk 26, но добавил вот такую либу.

    implementation 'com.android.support:recyclerview-v7:27.1.0'
А она 27 sdk требуется. Вот и была ошибкой. Даже когда на sdk 27 перешёл не понел, но gradle в файле было сообщение что может вызвать крах из-за библиотеки appcompat, и тогда я поменял на 27
    implementation 'com.android.support:appcompat-v7:27.1.0'
И всё заработало.

u0atgKIRznY5 ()