我的目录结构如下:
Project
--libraries
----volley
--myapplication
----libs
------android-support-v4.jar
------etc.jar
Volley 是一个导入的库项目。该应用程序一切正常,但安装后,Android 应用程序列表中会显示 2 个不同的应用程序,名称和图标相同。其中一个按预期工作,另一个似乎是一些空活动并在执行时崩溃并出现错误:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapplication/com.libs.volley.ACTIVITY_ENTRY_NAME}: java.lang.ClassNotFoundException: Didn't find class "com.libs.volley.ACTIVITY_ENTRY_NAME" on path: /data/app/com.example.myapplication-1.apk
我已经尝试从设备本身清理、重建和卸载,但无济于事。我想做的就是摆脱这个额外的应用程序。
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<application
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.myapplication.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AppConfigActivity"
android:windowSoftInputMode="stateHidden"
android:label="Application configuration"/>
<activity
android:name=".BoothSelectActivity"
android:label="Booth Select"/>
<activity
android:name=".InactiveActivity"
android:label="Inactive Activity"/>
<activity
android:name=".QRReaderActivity"
android:windowSoftInputMode="stateHidden"
android:label="QR Reader Activity"/>
<activity
android:name=".ProductsActivity"
android:windowSoftInputMode="stateHidden"
android:label="Products Activity"/>
</application>
任何帮助将非常感激。
我的 build.gradle 文件
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 18
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files('libs/commons-codec-1.4.jar')
compile files('libs/android-async-http-1.4.3.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/zbar.jar')
compile project(':libraries:volley')
}
task copyNativeLibs(type: Copy) {
from(new File('src/main/libs')) { include '**' }
into new File(buildDir, 'native-libs')
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir new File(buildDir, 'native-libs')
}
我的设置.gradle
include ':myapplicationname', ':libraries:volley'