Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java &引用;“应用程序未安装”;来自调试apk的设备错误“上”;“文件似乎已损坏”;_Java_Android - Fatal编程技术网

Java &引用;“应用程序未安装”;来自调试apk的设备错误“上”;“文件似乎已损坏”;

Java &引用;“应用程序未安装”;来自调试apk的设备错误“上”;“文件似乎已损坏”;,java,android,Java,Android,我正在尝试生成要安装到设备的apk。在Android Studio版本3.0.0之前,我也可以用同样的项目来完成这项工作。我无法发布任何错误日志,因为apk生成成功,但当我尝试在设备上安装它时,我会收到“未安装应用程序”,“文件似乎已损坏”。我已经通过了许多其他线程来尝试修复这个问题,但到目前为止没有任何效果 手机上的早期版本已被卸载。 已尝试签名和未签名。 即时运行已被禁用。 apk无法安装在至少3个不同的设备上。 我已经尝试降级我的com.android.tools.build:gradle

我正在尝试生成要安装到设备的apk。在Android Studio版本3.0.0之前,我也可以用同样的项目来完成这项工作。我无法发布任何错误日志,因为apk生成成功,但当我尝试在设备上安装它时,我会收到“未安装应用程序”,“文件似乎已损坏”。我已经通过了许多其他线程来尝试修复这个问题,但到目前为止没有任何效果

手机上的早期版本已被卸载。 已尝试签名和未签名。 即时运行已被禁用。 apk无法安装在至少3个不同的设备上。 我已经尝试降级我的com.android.tools.build:gradle

任何帮助都将不胜感激,我觉得我什么都试过了

build.gradle(应用程序):

build.gradle(项目):


让我知道我还可以发布什么来帮助获得解决方案。

从3.0.0生成调试apk的步骤+


构建->构建APK。我在另一个线程的某处找到了答案。在我的android清单中,我将testOnly=“true”设置为false,并将其修复。

这就是我生成apk的方式,但当我将其复制到手机并尝试安装时,会出现上述错误。确定。检查设备上是否有多个配置文件(如果有),然后从其他配置文件中卸载以前的apk。我已从设备上的所有配置文件中卸载。但这也是在一个从未有过以前版本的设备上尝试的,所以我认为这不是问题所在。
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "com.example.will3596.mobileapplication"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}

dependencies {
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.6.2'
compile 'com.google.firebase:firebase-auth:11.6.2'
compile 'com.google.firebase:firebase-database:11.6.2'
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services-location:11.6.2'
compile 'com.google.firebase:firebase-storage:11.6.2'
compile 'com.android.support:palette-v7:26.+'
compile 'com.android.support:customtabs:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:mediarouter-v7:26.+'
compile 'com.android.support:multidex:1.0.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.maps.android:android-maps-utils:0.4+'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.22'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
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 {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath 'com.google.gms:google-services:3.1.1'

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

allprojects {
repositories {
    jcenter()
    maven{
        url "https://maven.google.com"
    }
    google()
}
}

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