Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use in studio 3.0.1 and can not find 'xyz.sahildave.mylibrary' #2

Open
qlang122 opened this issue Feb 25, 2019 · 1 comment
Open

Use in studio 3.0.1 and can not find 'xyz.sahildave.mylibrary' #2

qlang122 opened this issue Feb 25, 2019 · 1 comment

Comments

@qlang122
Copy link

in android studio 3.0.1 , gradle-4.1-all.
the project build failed,can`t find the class.
output details:

C:\Users\Administrator\Desktop\Flavored-Library-master\app\src\main\java\xyz\sahildave\flavoredlibrary\MainActivity.java:7: 错误: 程序包xyz.sahildave.mylibrary不存在
import xyz.sahildave.mylibrary.LibraryActivity;
^
C:\Users\Administrator\Desktop\Flavored-Library-master\app\src\main\java\xyz\sahildave\flavoredlibrary\MainActivity.java:15: 错误: 找不到符号
Intent intent = new Intent(this, LibraryActivity.class);
^
符号: 类 LibraryActivity
位置: 类 MainActivity
2 个错误

FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileApp1521DebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.


but gradle config sysc is no error.

@qlang122
Copy link
Author

library build.gradle

apply plugin: 'com.android.library'

android {
buildToolsVersion "26.0.2"

publishNonDefault true

defaultConfig {
    versionCode 1
    versionName "1.0"
    flavorDimensions "default"
}
productFlavors {
    sdk1521 {
        minSdkVersion 15
        targetSdkVersion 26
        compileSdkVersion 26
    }
    sdk1524 {
        minSdkVersion 15
        targetSdkVersion 26
        compileSdkVersion 26
    }
}

}
configurations {
sdk1521Debug
sdk1524Debug
}
dependencies {
// compile 'com.android.support:appcompat-v7:24.2.1'
sdk1524Compile 'com.android.support:appcompat-v7:26.1.0'
sdk1521Compile 'com.android.support:appcompat-v7:26.1.0'
}

app build.gradle

apply plugin: 'com.android.application'

android {
buildToolsVersion "26.0.2"

defaultConfig {
    applicationId "xyz.sahildave.flavoredlibrary"
    versionCode 1
    versionName "1.0"

    flavorDimensions "default"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
    app1521 {
        minSdkVersion 15
        targetSdkVersion 26
        compileSdkVersion 26
        applicationId "xyz.sahildave.flavoredlibrary.app1521"
    }
    app1524 {
        minSdkVersion 15
        targetSdkVersion 26
        compileSdkVersion 26
        applicationId "xyz.sahildave.flavoredlibrary.app1524"
    }
}

}

configurations {
app1521DebugCompile
app1524DebugCompile
}

dependencies {
// compile 'com.android.support:appcompat-v7:24.1.0'
app1521DebugCompile project(path: ':mylibrary', configuration: 'sdk1521Debug')
app1524DebugCompile project(path: ':mylibrary', configuration: 'sdk1524Debug')
app1521DebugCompile 'com.android.support:appcompat-v7:26.1.0'
app1524DebugCompile 'com.android.support:appcompat-v7:26.1.0'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant