简体   繁体   English

已签名的APK,在某些设备中“未安装应用”以及在某些设备中,相同的apk正常运行

[英]Signed APK, “App not installed” in some devices, and in some devices same apk is working fine

I am new to android development. 我是android开发的新手。 I am working on a project which has diffrent activities out of which two use jSon parsing. 我正在一个项目中进行不同的活动,其中两个使用jSon解析。

My problem is, even while testing, my ap is working fine on some devices and failing on some. 我的问题是,即使在测试时,我的ap在某些设备上也可以正常工作,而在某些设备上却无法正常工作。 I have looked numerous answes on this issue, but nothing solves my problems. 在这个问题上,我看上去无数烦恼,但是没有什么能解决我的问题。 Also I had some other problems but I solved them by looking on the available answers, but this "not installed" issue remains the same. 我还遇到其他一些问题,但是我通过查看可用的答案解决了这些问题,但是这个“未安装”的问题仍然存在。 I have done the following: 我已经完成以下工作:

  • Created signed apk 创建签名的APK
  • Signed apk with "Release" option 使用“发布”选项签名的apk
  • Both the options ticked "JAR Signature" and "Full apk Signature" 这两个选项都勾选了“ JAR签名”和“完整apk签名”
  • Mentioned proper minimum and target sdk versions in gradle files 在gradle文件中提到了正确的最低和目标SDK版本
  • Using latest vesions of libraries like volley, picasso 使用排球,毕加索等图书馆的最新作品
  • Tried re-installing it after uninstalling it from Settings>Apps>My app.. 从“设置”>“应用程序”>“我的应用程序”中将其卸载后,尝试重新安装。

My concern is whatever the problems might there be inside the activities, at last the app should get installed and start the first activity(which is the splash screen, achieved by threading), but: The app is working perfectly fine on my device(Redmi 4) in both ways ie via USB and with the signed apk. 我担心的是活动中可能存在的任何问题,最后应安装该应用程序并启动第一个活动(这是启动屏幕,通过线程实现),但是:该应用程序在我的设备上运行正常(Redmi) 4)两种方式,即通过USB和带有签名的apk。 The app is working fine in some of my friends' devices which are from manufacturers like Honor, Lenovo, MI. 该应用程序在我的一些朋友的设备中运行良好,这些设备来自Honor,Lenovo,MI等制造商。 But the same apk is failing to install on another device Redmi 4 another version, which is the weirdest issue for me. 但是相同的apk无法在另一个设备Redmi 4的另一个版本上安装,这对我来说是最奇怪的问题。 And in some devices is getting installed but crashes the moment I open it, whether I do it via USB or with the signed APK. 在某些设备中,无论是通过USB还是使用签名的APK进行安装,都会在我打开它时崩溃。

But as the app is running fine on some devices, I think the problem isn't in the internal activities. 但是,由于该应用在某些设备上运行良好,因此我认为问题不在内部活动中。

Some of the answers that I have read and tried are: 我已阅读并尝试过的一些答案是:

Cannot install signed apk to device manually, got error “App not installed” 无法将签名的APK手动安装到设备,出现错误“未安装应用程序”

Getting “App Not Installed” on some devices from signed apk 通过签名的APK在某些设备上获取“未安装应用”

And every internal link provied in the answers. 答案中提供了每个内部链接。

Note: Some of the activity are entirely for testing purposes. 注意:有些活动完全是出于测试目的。

Here's my Manifest file: 这是我的清单文件:

<?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>

Here's my build.gradle file (app) 这是我的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'

Here's the logcat for when the app gets installed but crashes when I try to open it: 以下是安装应用程序但尝试打开时崩溃的日志:

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

Here's build.gradle file (project level): 这是build.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
}
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.RelativeLayout

This line is telling you that your xml is malformed. 此行告诉您xml格式错误。 Try to check the settings for android.widget.RelativeLayout 尝试检查android.widget.RelativeLayout的设置

Steps to Check for -Check if the app is already installed on that phone on which you not getting app not installed issue -As you are sharing apk file kindly make sure security settings of that phone Redmi4 from play store is off. 检查步骤-检查该应用程序是否已安装在未安装该应用程序的手机上-共享apk文件时,请确保已关闭Play商店中该手机Redmi4的安全设置。

than you wont be getting that issue 比你不会得到这个问题

I also faced similar issues on Redmi Devices, the work around for me is to Copy Signed apk in Downloads using Device file explorer option in Android Studio and then installing the apk. 我在Redmi设备上也遇到了类似的问题,对我来说,解决方法是使用Android Studio中的“使用设备文件资源管理器”选项在“下载内容中复制签名的apk”,然后安装apk。

Installing using ADB doesn't work for Redmi Devices 使用ADB进行安装不适用于Redmi设备

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM