当前位置: 首页 > 知识库问答 >
问题:

签署了APK,在某些设备中“未安装应用程序”,在某些设备上,相同的APK工作正常

康言
2023-03-14

我是android开发的新手。我正在从事一个项目,该项目有不同的活动,其中两个使用jSon解析。

我的问题是,即使在测试时,我的ap在一些设备上工作正常,但在一些设备上失败了。关于这个问题,我看了无数的回答,但是没有一个能解决我的问题。我也有一些其他问题,但我通过查看可用的答案解决了它们,但这个“未安装”的问题仍然是一样的。我做到了以下几点:

  • 创建签名apk
  • 签署了带有“发布”选项的apk
  • 两个选项都勾选了“JAR签名”和“完整apk签名”
  • 在gradle文件中提到了正确的最小和目标sdk版本
  • 使用最新版本的图书馆,如凌空,毕加索
  • 从设置中卸载后尝试重新安装它

我担心的是,无论活动中可能存在什么问题,最终应用程序都应该安装好并开始第一个活动(这是通过html" target="_blank">线程实现的闪屏),但是:应用程序在我的设备(Redmi 4)上以两种方式工作得非常好,即通过USB和签名的apk。这款应用在我一些朋友的设备上运行良好,这些设备来自Honor、Lenovo、MI等制造商。但同一个apk无法在另一台设备上安装Redmi 4另一个版本,这对我来说是最奇怪的问题。有些设备正在安装,但当我打开它的时候就崩溃了,不管我是通过USB还是通过签名的APK。

但由于这款应用在一些设备上运行良好,我认为问题不在于内部活动。

我读过并尝试过的一些答案是:

无法手动将签名的apk安装到设备,出现错误“未安装应用程序”

从签名的apk在某些设备上获取“未安装应用程序”

以及答案中提供的每个内部链接。

注意:某些活动完全用于测试目的。

这是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.diginfoexpert.MBAutodeals">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".Globals"
        android:allowBackup="true"
        android:icon="@mipmap/audi"
        android:roundIcon="@mipmap/audi_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        android:testOnly="false"
        android:largeHeap="true">
        <activity android:name=".Web_json_product_Activity"></activity>
        <activity android:name=".Web_jsonActivity">

        </activity>
        <activity android:name=".jSonParseActivity"></activity>
        <activity android:name=".SignUpActivity"
            android:noHistory="true"/>
        <activity android:name=".LoginActivity"
            android:noHistory="true"/>
        <activity android:name=".ProductActivity" />
        <activity android:name=".IntroActivity" />
        <activity
            android:name=".SplashScreenActivity"
            android:noHistory="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".MainActivity" />
    </application>

</manifest>

这是我的build.gradle文件(应用程序)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.diginfoexpert.MBAutodeals"
        minSdkVersion 18
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.preference:preference:1.1.0-alpha05'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'gr.pantrif:easy-android-splash-screen:0.0.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-appindexing:19.0.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

apply plugin: 'com.google.gms.google-services'

这是安装应用程序但在我尝试打开它时崩溃的logcat:

07-10 12:31:25.402 2278-4229/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f5d1f6b60
07-10 12:31:25.408 4049-4177/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f47e481c0
07-10 12:31:25.508 22804-22804/? E/Minikin: addFont failed to create font /system/fonts/NanumGothic.ttf
07-10 12:31:25.508 22804-22804/? E/Minikin: addFont failed to create font /system/fonts/DroidSansFallback.ttf
07-10 12:31:25.508 22804-22804/? E/Minikin: addFont failed to create font /system/fonts/MTLmr3m.ttf
07-10 12:31:25.603 22804-22804/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.diginfoexpert.MBAutodeals, PID: 22804
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.diginfoexpert.MBAutodeals/com.diginfoexpert.MBAutodeals.SplashScreenActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.widget.RelativeLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2560)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626)
        at android.app.ActivityThread.-wrap11(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:207)
        at android.app.ActivityThread.main(ActivityThread.java:5740)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766)
     Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.widget.RelativeLayout
        at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
        at com.diginfoexpert.MBAutodeals.SplashScreenActivity.onCreate(SplashScreenActivity.java:14)
        at android.app.Activity.performCreate(Activity.java:6543)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2513)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5740) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766) 
     Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.RelativeLayout
        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532) 
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) 
        at com.diginfoexpert.MBAutodeals.SplashScreenActivity.onCreate(SplashScreenActivity.java:14) 
        at android.app.Activity.performCreate(Activity.java:6543) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2513) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5740) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766) 
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at android.view.LayoutInflater.createView(LayoutInflater.java:619)
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532) 
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) 
        at com.diginfoexpert.MBAutodeals.SplashScreenActivity.onCreate(SplashScreenActivity.java:14) 
        at android.app.Activity.performCreate(Activity.java:6543) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2513) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5740) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766) 
     Caused by: android.content.res.Resources$NotFoundException: Resource "com.diginfoexpert.MBAutodeals:drawable/car_background" (7f070069) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f070069 a=-1 r=0x7f070069}
        at android.content.res.Resources.loadDrawableForCookie(Resources.java:2842)
        at android.content.res.Resources.loadDrawable(Resources.java:2764)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
        at android.view.View.<init>(View.java:4001)
        at android.view.ViewGroup.<init>(ViewGroup.java:599)
        at android.widget.RelativeLayout.<init>(RelativeLayout.java:268)
        at android.widget.RelativeLayout.<init>(RelativeLayout.java:264)
        at android.widget.RelativeLayout.<init>(RelativeLayout.java:260)
        at java.lang.reflect.Constructor.newInstance(Native Method) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532) 
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) 
        at com.diginfoexpert.MBAutodeals.SplashScreenActivity.onCreate(SplashScreenActivity.java:14) 
        at android.app.Activity.performCreate(Activity.java:6543) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2513) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5740) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766) 
07-10 12:31:26.339 1012-1724/? E/Sensors: handleToDriver handle(0)
07-10 12:31:26.339 1012-1724/? E/Sensors: handleToDriver handle(0)
07-10 12:31:26.340 1012-1724/? E/Sensors: new setDelay handle(0),ns(20000000)m, error(0), index(2)
07-10 12:31:26.341 1012-1724/? E/Accel: ACC batch: handle:0, en:0,samplingPeriodNs:20000000 maxBatchReportLatencyNs:0 
07-10 12:31:26.341 1012-1724/? E/Sensors: sensor 0 go to common batch
07-10 12:31:26.341 1012-1724/? E/Sensors: handleToDriver handle(0)
07-10 12:31:26.362 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.382 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.402 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.422 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.442 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.462 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.482 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.502 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.522 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.542 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.562 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.582 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.602 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.622 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.642 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.663 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.682 1012-1263/? E/Sensors: readEvents: no events readed, continue to try next fd
07-10 12:31:26.847 285-569/? E/MAL-Daemon:  (  rds_ru_3gpp_status_ind, 1421) [RDS-E][RU][EVENT_RU_DM_3GPP_STATUS_IND] Invalid u43gpp_status:0x6

这是一个构建。gradle文件(项目级):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

共有3个答案

龚浩宕
2023-03-14

我在Redmi设备上也遇到了类似的问题,我的解决方法是使用Android Studio中的设备文件资源管理器选项在下载中复制已签名的apk,然后安装apk。

使用ADB安装不适用于Redmi Devices

白昊乾
2023-03-14

检查步骤 - 检查该应用程序是否已安装在您未安装应用程序问题的手机上 - 当您共享apk文件时,请确保该手机的安全设置Redmi4从Play商店已关闭。

比你不会得到这个问题

罗学林
2023-03-14
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.RelativeLayout

这一行告诉您xml的格式不正确。尝试检查android.widget.RelativeLayout的设置

 类似资料:
  • 我正试图在后台获取用户位置。在我的手机(htc one m7)上一切都很好,但出于某种原因,它不能在我测试的两个设备上工作:三星galaxy s3索尼Xperia Z1 顺便说一句:我把所有东西都添加到了清单中。

  • 最近,我们在Android应用程序中增加了对Chromecast的支持,但在对各种移动设备(手机和平板电脑)的扩展测试中,发现在许多移动设备上,Flipps应用程序都没有发现Chromecast。在相同的设备上,我们使用了最新版本的官方Chromecast SDK演示应用程序进行测试,该应用程序从https://github.com/googlecast/castvideo-Android下载(主

  • 我的Android应用程序无法安装在一些“随机”、较旧的API设备上(任何低于API级别25的设备),错误如下: 所以,基本上看起来… API 我见过类似的问题,答案与小写的包名有关。我已经有了。 有人有什么想法吗? 舱单: BTW我用的是Visual Studio 2019和一夫一妻制3.7

  • 无法在我的手机上安装已签名的发行版APK,也无法将其上载到Play Store上。 我创建了一个带有V1和V2 JAR签名复选框的签名发行版APK。当我尝试将APK放在我的手机上并安装它时: 未安装应用程序 没有JAR签名。 我使用的是Android Studio3.3版本,我正在处理一个Play Store Jar签名错误(重复选中V1和V2复选框,并且都选中了)。 播放存储错误: 这可能是一个

  • 我试图将谷歌地图集成到我的应用程序中。谷歌地图在调试版apk中运行良好。此外,我正在生成签名apk并安装在设备中。谷歌地图在签名apk版本中运行良好。但是当我从Play商店安装我的应用程序时——谷歌地图未加载显示空白(在API Console中添加SHA-1键并为android启用谷歌地图sdk)。我正在使用- 有什么我需要升级的吗?

  • 我刚刚在play store上发布了我的应用程序,我注意到一些三星设备没有显示我应用程序的图标,而是使用了android Studio的默认图标。你知道是什么引起的吗?我很困惑