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

buildException:java.io.ioException:未能生成v1签名

何高歌
2023-03-14

有时,我的项目在这个时刻无法运行(它重建成功,但不能运行):不幸的是,我还不熟练的梯度材料,请帮助Q_Q

:app:mergedebugjnilibfolders 4ms

:app:TransformNativelibsWithMergeJNilibsForDebug 359ms

:app:ProcessDebugJavares

:app:TransformResourcesWithMergeJavaResforDebug 436ms

它说:by:java.lang.IllegalArgumentException:缺少强制的Manifest-Version属性

清单文件内容如下:

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

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


    <application
        android:name="net.c7j.wna.MyApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <uses-library android:name="com.google.android.maps" />

        <service android:name="net.c7j.wna.presentation.service.ForegroundService"/>
        <receiver android:name="net.c7j.wna.presentation.service.MyAlarmReceiver">
            <intent-filter>
                <action android:name="com.example.helloandroid.alarms" />
            </intent-filter>
        </receiver>

        <service android:name="net.c7j.wna.presentation.bootservice.AlarmSetService"/>
        <receiver android:name="net.c7j.wna.presentation.bootservice.BootReceiver" android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>


        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_maps_api_key" />

        <activity
            android:name="net.c7j.wna.presentation.view.ActivityPlay"
            android:windowSoftInputMode="adjustResize"
            android:screenOrientation="portrait"
            android:launchMode="singleTask"
            >

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

    </application>

</manifest>

以下是构建分级文件:

apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "net.c7j.wna"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        pickFirst 'META-INF/*'
    } // for butterknife
    lintOptions {
        disable 'ContentDescription'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

def ver = [:]
ver.butterknife = "8.8.1"
ver.constraint = "1.0.2"
ver.glide = "3.8.0"
ver.okhttp_logging_interceptor = "3.9.0"
ver.picasso = "2.71828"
ver.retrofit2 = "2.3.0"
ver.room = "1.1.0-beta2"
ver.rx_java2 = "2.1.3"
ver.rx_android2 = "2.0.1"
ver.stetho = "1.5.0"
ver.support = "27.1.0"
ver.play_services = "12.0.1";
//

dependencies {
    implementation "com.google.firebase:firebase-core:$ver.play_services"
    implementation "com.google.android.gms:play-services-ads:$ver.play_services"
    implementation "com.google.android.gms:play-services-maps:$ver.play_services"
    implementation "com.android.support:appcompat-v7:$ver.support"
    implementation "com.android.support:recyclerview-v7:$ver.support"
    implementation "com.android.support:design:$ver.support"
    implementation "com.android.support.constraint:constraint-layout:$ver.constraint"
    implementation "com.jakewharton:butterknife:$ver.butterknife"
    annotationProcessor "com.jakewharton:butterknife-compiler:$ver.butterknife"
    implementation "com.squareup.picasso:picasso:$ver.picasso"
    implementation "io.reactivex.rxjava2:rxjava:$ver.rx_java2"
    implementation "io.reactivex.rxjava2:rxandroid:$ver.rx_android2"
    implementation "com.squareup.retrofit2:retrofit:$ver.retrofit2"
    implementation "com.squareup.retrofit2:converter-gson:$ver.retrofit2"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$ver.retrofit2"
    implementation "android.arch.persistence.room:runtime:$ver.room"
    implementation "android.arch.persistence.room:rxjava2:$ver.room"
    annotationProcessor "android.arch.persistence.room:compiler:$ver.room"
    implementation "com.facebook.stetho:stetho:$ver.stetho"
}

//gradle assemble --stacktrace
//Don't move this apply plugin above or project will fail to build
apply plugin: 'com.google.gms.google-services'

根构建。梯度:

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


buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
        classpath 'com.google.gms:google-services:3.2.0'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

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

运行gradle assemble后--StackTrace:

错误:失败:生成失败,出现异常。

>

  • 出错原因:在根项目'WNA3'中找不到任务'gradle'。

    在3s中生成失败

    完整堆栈跟踪:

  • 共有1个答案

    简学文
    2023-03-14
    packagingOptions {
            exclude 'META-INF/services/javax.annotation.processing.Processor'
            pickFirst 'META-INF/*'
        } // for butterknife
    

    这句台词就是原因。移除一切都好。

     类似资料:
    • 我对flutter的编译有问题 我已尝试调试但未成功

    • 从我的终端运行时,它只生成以下APK。请告诉我如何从android Studio获得默认的未签名apk。我尝试为带有空密钥库的unsigned创建单独的buildType,但没有任何用处。

    • 我有一个问题,当我安装库贝-dns插件。我的操作系统是CentOSLinux版本7.0.1406(核心) 我的api服务器配置: api服务器授权模式设置为AlwaysAllow 我的库贝-dns配置YAML文件是: 当我启动库贝-dns容器日志时: 几分钟后,吊舱坠毁。 我的kubernetes版本是: docker版本: 我的kubernetes服务配置:api服务器 控制器-管理器: 调度程

    • 我有一个用例,我使用lambda函数生成有符号的网址上传到S3桶,我还在生成有符号的网址时设置了元数据值,我的boto3版本是boto3==1.18.35。以前,当我生成有符号的网址上传到桶时,网址看起来像这样: https://bucket-name.s3.amazonaws.com/scanned-file-list/cf389880-09ff-4301-8fa7-b4054941685b/6

    • 请至少选择一个在Android Studio 2.3中使用的签名版本 现在,在Android Studio中生成签名APK时,它显示了两个选项(复选框),即1。和2。作为签名APK生成过程最后一步的签名版本。 那么,在新的Android Studio更新中,V1(Jar签名)和V2(完全APK签名)有什么区别呢? 另外,当我使用第二个选项时,我在安装APK时收到错误Install Parse Fa

    • 我正在尝试构建我的第一个签名APK以供发布,但出现了一些错误。看起来效果很好,但现在我就是无法生成APK。我做了研究,但什么也没找到。 Gradle版本:4.8,Android插件版本3.1.4,这是我的应用程序Gradle屏幕截图:link 这来自assembleDebug: 我曾经有过布局和不赞成使用的功能的其他问题,但我解决了它。其中一个就这样消失了,但我什么也没做:-) 我已经尝试过的事情