【问题标题】:android app not showing category images after generating signed apk. why?生成签名的 apk 后,android 应用程序不显示类别图像。为什么?
【发布时间】:2018-10-01 16:31:09
【问题描述】:

我是一名安卓学习者。我怀疑任何人都可以解决我的错误。我构建了一个普通的新闻故事应用程序。在 android studio 中,我构建了一个 100% 运行良好且没有错误的应用程序,并且所有应用程序功能都运行良好。然后在我生成构建 apk 以检查真实设备之后。安装 build apk 后,在真机上运行良好。

生成签名的 apk 并安装在真实设备上后。它没有在签名的 apk 上显示类别图像。但类别图像正在构建 apk 中。

我不知道为什么类别图像没有显示在签名的 apk 中。我不明白为什么它不会来。

后台使用 PHP 作为管理面板...

查看图像的差异...

Build apk showing category images please check image 1

signed apk not showing category images please check image 2

build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId 'com.example.demo'
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:21.0.3'
    implementation 'com.google.android.gms:play-services:6.5.87'
    implementation 'com.android.support:recyclerview-v7:21.+'

}

proguard-rules.pro:

   # Add project specific ProGuard rules here.
    # By default, the flags in this file are appended to flags specified
    # in G:\Programs\SDK\tools\proguard/proguard-android.txt
    # You can edit the include path and order by changing the proguardFiles
    # directive in build.gradle.
    #
    # For more details, see
    #   http://developer.android.com/guide/developing/tools/proguard.html

    # Add any project specific keep options here:

    # If your project uses WebView with JS, uncomment the following
    # and specify the fully qualified class name to the JavaScript interface
    # class:
    #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
    #   public *;
    #}

【问题讨论】:

  • 请检查 logcat 是否有错误消息,如果有,请分享错误消息。是的,请与您的build.gradle 文件一起分享您的proguard-rules.pro 以及文件。
  • 使用“proguard-rules.pro”和 build.gradle 更新帖子请检查一次@ReazMurshed
  • 这些图片是从网络加载的吗?
  • 是的图片来自服务器@sravs

标签: android build.gradle


【解决方案1】:

更新:

Gradle build success but build failed with 53errors.. java compilation errors... one of the error mention here.. error: cannot find symbol class ActionBarActivity 'import android.support.v7.app.ActionBarActivity;',private ActionBarActivity activity;

Gradle 正在运行。问题来自ActionBarActivity。在您的课程中使用AppCompatActivity,在您的onCreate() 方法中使用getSupportActionbar()


我强烈建议使用最新版本:

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0' // must have the same version with the appcompat
implementation 'com.google.android.gms:play-services:12.0.1'

您已将21.+ 用于RecyclerView21.0.3 用于AppCompat使用相同的版本。也许将21.+ 用于RecyclerView 可能会导致问题。

通过this link查看 Google Play 服务的最新版本。

请注意,您还需要定义compileSdkVersion 等,如下所示:

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 28
      ...

另外,在根 Build.gradle 中,更新 gradle:

classpath 'com.android.tools.build:gradle:3.2.0'

【讨论】:

  • 谢谢你的分享我只是在更新你的建议让我们看看会发生什么@monsen
  • 目标 sdkversion 应该与 compileSdkVersion 的版本相同。这也可能导致问题,所以我添加了我的Build.gradle,你只需要升级它们。我希望这会成功。 :)
  • 显示此 gradle 同步错误消息 支持的最低 Gradle 版本为 4.6。当前版本是 4.4。请修复项目的 Gradle 设置。修复 Gradle 包装器并重新导入项目 Gradle 设置
  • 这里解释得很好:stackoverflow.com/questions/43077386/… 您可能需要将当前版本更改为 4.6
  • 是的,我只是更新到 4.6 版本让我们看看会发生什么...非常感谢您在这里的支持。 @monsen
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-08-10
  • 2017-03-08
  • 1970-01-01
  • 1970-01-01
  • 2019-11-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多