gpt4 book ai didi

android - 安装 apk 时出错 - 解析包

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:59:42 26 4
gpt4 key购买 nike

我正在开发一个 Android 应用程序,当我在本地系统中构建它并在模拟器上运行时一切正常,但是一旦我在手机上制作、发布和安装 apk,它就会因错误而崩溃 -

There was an error parsing the package

如您所见,我正在使用最新的 SDK 和构建工具进行构建,我的手机也在 API 上运行相同的版本。我也允许安装 Untrusted Sources

我在 this 上寻求“构建发布版本”部分的帮助关联。它在我的 app/build/outputs/apk 文件夹中生成一个类似 - app-release-unsigned.apk 的文件。请帮忙。

模拟器 AVD -

Galaxy Nexus, 1 GB RAM, API 22 (Android 5.1.1), CPU x86

我的手机 -

Nexus 5, 2 GB RAM, Android 5.1.1

build.gradle -

apply plugin: 'android'
apply plugin: 'com.android.application'

repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}

android {
compileSdkVersion 22 // api version
buildToolsVersion "22.0.1" // build tools version

defaultConfig {
applicationId "org.compani.proj"
minSdkVersion 8
targetSdkVersion 22 // same as compilesdkversion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
dependencies {
//compile project(':android-beacon-library')
compile 'org.altbeacon:android-beacon-library:2+@aar'
}
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
compile 'com.android.support:support-v4:+'
}

AndroidManifest.xml -

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="22" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="MyApp">
<activity
android:name="org.compani.proj.MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

发布消息 -

23:43:42: Executing external task 'assembleRelease'...
Configuration on demand is an incubating feature.
:app:preBuild
:app:preReleaseBuild
:app:checkReleaseManifest
:app:preDebugBuild
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72103Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareOrgAltbeaconAndroidBeaconLibrary214Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:processReleaseManifest
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:compileReleaseJava UP-TO-DATE
:app:lintVitalRelease
:app:compileReleaseNdk UP-TO-DATE
:app:preDexRelease UP-TO-DATE
:app:dexRelease UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:packageRelease UP-TO-DATE
:app:assembleRelease

BUILD SUCCESSFUL

Total time: 6.309 secs
23:43:49: External task execution finished 'assembleRelease'.

最佳答案

生成的 APK 是未签名的 (app-release-unsigned.apk)。您无法在物理设备上安装未签名的 APK。您有两个选择:

关于android - 安装 apk 时出错 - 解析包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29682002/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com