"包裹不退出"从Eclipse转换后编译项目时出错

时间:2017-02-09 14:54:32

标签: android eclipse android-studio gradle

我已经为AndroidStudio转换了一个Eclipse项目然后我遇到了一些错误"包没有退出",它包是库模块。

图书馆项目的gradle脚本如下。

apply plugin: 'com.android.library'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 1
        versionName "1.0.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
        }
        debug {
            minifyEnabled false
        }
    }
    lintOptions {
        abortOnError false
    }
    useLibrary 'org.apache.http.legacy'
}

dependencies {
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.google.android.gms:play-services:9.0.0'
}

和项目的gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "xxxxxxxxxxxxxxxxx"
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 1
        versionName "1.0.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
        }
        debug {
            minifyEnabled false
        }
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.google.android.gms:play-services:9.0.0'
    compile project(':library')
}

这很奇怪,因为IDE在编码时没有显示任何错误,并且可以正确导入包但是当我尝试"运行"该项目,然后发生错误。

如果有人能解决这个问题,我将不胜感激。

被修改

项目结构如下 - app(com.sample.apps)
- library(com.sample.library)

实际错误消息

package com.sample.library.xxx does not exits // <- My Custom Class. There are hundreds of errors.

Gradle Errors

:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
100 errors

:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.344 secs

解决

我通过使用产品口味解决了这个问题。 这是因为图书馆项目将应用proguard,这就是为什么应用程序项目无法找到包。

我改变了:com:android:library&#39; to&#39; com:android:application&#39;并将app项目作为产品风格移动。

0 个答案:

没有答案