小编MD *_*raf的帖子

尝试生成签名Apk时出现Gradle构建错误

大约34小时前我生成了一个签名的apk但现在,我一直无法生成签名的Apk,我不知道如何解决这个问题.请帮忙

这是我的输出消息

错误:注意:有11个重复的类定义.(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)FAILURE:构建因异常而失败.

在10s内建立失败

这是我的build.gradle(app)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.myapp……"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 5
        versionName "5.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:$support_version"
    implementation …
Run Code Online (Sandbox Code Playgroud)

android proguard gradle android-gradle-plugin

8
推荐指数
1
解决办法
6401
查看次数

如何更改汉堡菜单图标的颜色?

首先,我想澄清一下,我愿意更改汉堡导航菜单图标本身的颜色,而不是导航菜单中的图标。

我遵循了本教程:https://developer.android.com/training/implementing-navigation/nav-drawer#DrawerButton

结果,我在应用程序栏中有一个导航菜单图标(汉堡包)。问题:图标为黑色(Vector 可绘制的默认颜色)。

我创建了一种新样式:

<!-- Hamburger menu -->
<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="color">@color/colorTextTitle</item>
</style>
Run Code Online (Sandbox Code Playgroud)

然后我将此样式添加到我的主题中:

<style name="customTheme" parent="Theme.AppCompat.NoActionBar">
    <!-- Hamburger menu -->
    <item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
</style>
Run Code Online (Sandbox Code Playgroud)

确保这种样式是我的应用程序在清单中使用的样式:

<application>
    android:theme="@style/customTheme"
</application>
Run Code Online (Sandbox Code Playgroud)

并且还将这个主题应用到工具栏(以防万一......)

<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorToolbarBackground"
            app:theme="@style/customTheme"
            app:popupTheme="@style/customTheme"
            app:title="@string/app_name"
            app:titleTextColor="@color/colorTextBody">

        </android.support.v7.widget.Toolbar>
    </FrameLayout>
Run Code Online (Sandbox Code Playgroud)

操作结果:这些都没有任何效果。汉堡包图标仍然是极其黑色的。

你们中的任何人都可以向我解释我犯了什么错误以及如何改变这种颜色吗?

android hamburger-menu

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

软件包androidx.appcompat.widget不存在Android Studio

我创建了一个自定义类,该类扩展了ImageView。直到出现AndroidX,它的工作情况都非常好。

在这里,java代码

import android.content.Context;
import android.graphics.BitmapFactory;
import android.util.Base64;
import android.widget.RelativeLayout;

import androidx.appcompat.widget.AppCompatImageView;


public class CloseView extends AppCompatImageView {

    public CloseView(Context context) {
        super(context);
        init();
    }
...

Run Code Online (Sandbox Code Playgroud)
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)

Android对此文件显示2个错误

  1. 错误:找不到符号类AppCompatImageView
  2. 错误:程序包androidx.appcompat.widget不存在

有谁能解决这个问题?

java android imageview androidx

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