小编Kri*_*ena的帖子

XML渲染错误Android预览N.

我在更新后更新了android SDK到android预览版N,我收到了这个xml渲染错误.点击详细信息后,它显示以下堆栈跟踪如何避免这种情况

?

org.jetbrains.android.uipreview.RenderingException: Failed to load the LayoutLib: com/android/layoutlib/bridge/Bridge : Unsupported major.minor version 52.0
at org.jetbrains.android.uipreview.LayoutLibraryLoader.load(LayoutLibraryLoader.java:90)
at org.jetbrains.android.sdk.AndroidTargetData.getLayoutLibrary(AndroidTargetData.java:180)
at com.android.tools.idea.rendering.RenderService.createTask(RenderService.java:166)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:649)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:80)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:594)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:589)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)

xml android android-studio android-n-preview

93
推荐指数
3
解决办法
3万
查看次数

Android Studio 2.3中的独立SDK Manager选项

我最近将Android Studio从2.2.3更新到2.3.现在看不到"启动独立SDK管理器"选项,这对检查更新,谷歌播放服务等很有用.

android-studio android-studio-2.3

59
推荐指数
5
解决办法
6万
查看次数

位于 ~/Library/Android/sdk/ndk-bundle 的 NDK 没有 source.properties 文件

我已在 Macbook 中将 Android Studio 更新到 4.1,但更新后无法运行应用程序。它给出了以下错误

Execution failed for task ':app:stripDebugDebugSymbols'.
NDK at ~/Library/Android/sdk/ndk-bundle did not have a source.properties file
Run Code Online (Sandbox Code Playgroud)

android android-ndk android-studio build.gradle

37
推荐指数
13
解决办法
4万
查看次数

无法解决:`com.google.android.gms:play-services-appindexing:10.0.0`

设置compile 'com.google.android.gms:play-services-appindexing:10.0.0'它时会出现以下错误:

Error:(82, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.0
Run Code Online (Sandbox Code Playgroud)

并在设置compile 'com.google.android.gms:play-services-appindexing:9.8.0'它时给出以下错误:

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.0.
Run Code Online (Sandbox Code Playgroud)

如果有人能告诉我这是错误的,那将是非常感激的,因为休息游戏服务版本10.0.0正常工作.

我的build.gradle文件

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.22.0'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    signingConfigs {

    } …
Run Code Online (Sandbox Code Playgroud)

android android-app-indexing

31
推荐指数
4
解决办法
4万
查看次数

Android ActivityResult API 未解决的引用错误 registerForActivityResult

我正在尝试使用此处所述的ActivityResult APIs ActivityResult APIs

但它给出了未解决的参考错误。

在此处输入图片说明

我正在使用以下依赖项

api 'androidx.activity:activity:1.1.0'
api 'androidx.activity:activity-ktx:1.1.0'
api 'androidx.fragment:fragment:1.2.5'
api 'androidx.fragment:fragment-ktx:1.2.5'
Run Code Online (Sandbox Code Playgroud)

android kotlin android-studio registerforactivityresult getcontent

7
推荐指数
1
解决办法
2425
查看次数

将目标SDK更新为android P后,APK安装失败

我已经将编译SDK和目标SDK版本更新到android P但是在更新应用程序无法安装之后,即使从我的设备卸载旧版本的APK后,也会给出相同的错误弹出窗口.

我的build.gradle设置:

compileSdkVersion 'android-P'
    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 15
        targetSdkVersion 'P'
        versionCode 31
        versionName "1.2.14"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
Run Code Online (Sandbox Code Playgroud)

弹出错误

android android-studio android-9.0-pie

6
推荐指数
1
解决办法
613
查看次数

红米 7A 启动相机拍照时应用程序崩溃

当我在红米7A上启动相机拍照时,我的应用程序自动崩溃。以下是崩溃日志:

   E/CAM_CameraIntentManager: checkCallerLegality: Unknown caller: com.qikcircle.eclinic
Run Code Online (Sandbox Code Playgroud)

请帮助它确实没有显示到底是什么问题。

我的活动代码

class CaptureImageActivity : AppCompatActivity() {

    private lateinit var mToolbar: Toolbar
    private lateinit var mImage: ImageView
    private var mBitmap: Bitmap? = null

    private val getCameraAndStoragePermission = registerForActivityResult(
            ActivityResultContracts.RequestMultiplePermissions()) { permissions ->
        if (hasAllPermissionsGranted(permissions)) {
            dispatchTakePictureIntent()
        } else {
            Toast.makeText(
                    this,
                    resources.getString(R.string.allow_camera_permission),
                    Toast.LENGTH_SHORT)
                    .show()
            finish()
        }
    }

    private val takePicture =
            registerForActivityResult(ActivityResultContracts.TakePicture()) { success ->
        if (success) {
            photoURI.let {
                mBitmap = getBitmap(this, photoURI)
                mImage.setImageBitmap(mBitmap)
                goBack()
            }
        } else {
            Toast.makeText(
                    this,
                    resources.getString(R.string.something_went_wrong),
                    Toast.LENGTH_SHORT) …
Run Code Online (Sandbox Code Playgroud)

android android-camera android-camera-intent kotlin redmi-device

5
推荐指数
1
解决办法
3198
查看次数

生成签名APK时出现改造2.3.0错误

我已经更新了Retrofit v 2.3.0和okhttp 3.8.0和okio 1.13.0但是现在我正在尝试生成签名的APK时出现以下错误:

Warning:retrofit2.OkHttpCall: can't find referenced class javax.annotation.concurrent.GuardedBy
Warning:there were 3 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.

Job failed, see logs for details 
Run Code Online (Sandbox Code Playgroud)

以下是我用于Retrofit和OKHTTP的程序规则

# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic …
Run Code Online (Sandbox Code Playgroud)

android proguard retrofit2

4
推荐指数
1
解决办法
3691
查看次数

更新为支持库23.2.1后,底部空间非常大的RecyclerView项目

我已经将支持库更新到23.2.1,之后回收物品项目出现了很大的空白区域.虽然我使用的是recyclerview,它的父视图高度为WRAP_CONTENT.我的应用程序一次从服务器获取10个项目数据,当向上滚动时,它在底部显示一个进度条,所以当时(当显示进度条时)recyclelerview项目显示的空间非常大.

在此输入图像描述

片段和适配器的xml文件代码分别为:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:paddingTop="?attr/actionBarSize"
        android:scrollbars="vertical"
        android:id="@+id/recycler_view"/>

    <include layout="@layout/date_picker_layout"
        android:id="@+id/date"
        android:layout_height="?attr/actionBarSize"
        android:layout_width="match_parent"/>

    <LinearLayout
        android:layout_width="@dimen/sort_view_width"
        android:layout_height="@dimen/sort_view_height"
        android:visibility="gone"
        android:id="@+id/sort_layout"
        android:background="@drawable/date_picker_selector"
        android:baselineAligned="false"
        android:weightSum="2"
        android:orientation="horizontal"
        android:divider="@drawable/vertical_divider"
        android:layout_gravity="center"
        android:gravity="center"
        android:showDividers="middle"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_marginRight="@dimen/margin_large"
        android:layout_marginBottom="@dimen/margin_large">

        <ImageView
            android:layout_width="0dp"
            android:layout_height="@dimen/button_size"
            android:layout_weight="1"
            android:padding="@dimen/margin_xxsmall"
            android:id="@+id/low_to_high"
            android:src="@drawable/ic_sort_down"/>

        <ImageView
            android:layout_width="0dp"
            android:layout_height="@dimen/button_size"
            android:layout_weight="1"
            android:padding="@dimen/margin_xxsmall"
            android:id="@+id/high_to_low"
            android:src="@drawable/ic_sort_up"/>

    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawableBottom="@drawable/three_dot"
        android:visibility="gone"
        android:textSize="@dimen/textsize_medium"
        android:text="@string/coming_soon"
        android:id="@+id/no_items"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

adapter.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:wheel="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/itemview">

    <ImageView
        android:id="@+id/image"
        android:layout_height="@dimen/list_image_height"
        android:layout_width="match_parent"
        android:scaleType="centerCrop"
        android:adjustViewBounds="true"/>

    <com.example.views.CircularProgressWheel
        android:layout_width="@dimen/progressbar_width"
        android:layout_height="@dimen/progressbar_height"
        android:id="@+id/progress_bar" …
Run Code Online (Sandbox Code Playgroud)

android android-recyclerview

0
推荐指数
1
解决办法
3911
查看次数