安卓工作室复制生成的文件



Android 工作室不断创建生成的类,即使它们已经存在。

我想这个问题与导航参数有关,但它总是给出一些重复的错误。

现在解决我问题的唯一方法是每次在运行应用程序之前清理整个项目。

有谁知道如何解决这个问题,我怎么知道哪个实现导致了此错误?

格拉德尔项目

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.0-beta01"
classpath ('com.google.firebase:firebase-plugins:1.1.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

格拉德尔模块

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: "androidx.navigation.safeargs"
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.umbrella.budgetapp"
minSdkVersion 28
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.github.ronaldsmartin:Material-ViewPagerIndicator:1.0.4'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'org.jetbrains:annotations:15.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.bumptech.glide:glide:4.10.0'
}

构建输出

> Task :app:compileDebugJavaWithJavac
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/buildConfig/debug/com/umbrella/budgetapp/BuildConfig 2.java:6: error: class BuildConfig is public, should be declared in a file named BuildConfig.java
public final class BuildConfig {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/buildConfig/debug/com/umbrella/budgetapp/BuildConfig.java:6: error: duplicate class: com.umbrella.budgetapp.BuildConfig
public final class BuildConfig {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/IconsDirections 4.java:9: error: class IconsDirections is public, should be declared in a file named IconsDirections.java
public class IconsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalDetailsDirections 6.java:9: error: class GoalDetailsDirections is public, should be declared in a file named GoalDetailsDirections.java
public class GoalDetailsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalsReachedDirections 4.java:16: error: class GoalsReachedDirections is public, should be declared in a file named GoalsReachedDirections.java
public class GoalsReachedDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/PlannedPaymentsDirections 4.java:16: error: class PlannedPaymentsDirections is public, should be declared in a file named PlannedPaymentsDirections.java
public class PlannedPaymentsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/PlannedPaymentsDirections.java:16: error: duplicate class: com.umbrella.budgetapp.Layouts.Fragments.PlannedPaymentsDirections
public class PlannedPaymentsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalsReachedDirections.java:16: error: duplicate class: com.umbrella.budgetapp.Layouts.Fragments.GoalsReachedDirections
public class GoalsReachedDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalsPausedDirections 4.java:16: error: class GoalsPausedDirections is public, should be declared in a file named GoalsPausedDirections.java
public class GoalsPausedDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/ShoppingListItemsArgs 4.java:13: error: class ShoppingListItemsArgs is public, should be declared in a file named ShoppingListItemsArgs.java
public class ShoppingListItemsArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalsActiveDirections 5.java:16: error: class GoalsActiveDirections is public, should be declared in a file named GoalsActiveDirections.java
public class GoalsActiveDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/DebtsBorrowedDirections 5.java:16: error: class DebtsBorrowedDirections is public, should be declared in a file named DebtsBorrowedDirections.java
public class DebtsBorrowedDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/ShoppingItemsArgs 4.java:13: error: class ShoppingItemsArgs is public, should be declared in a file named ShoppingItemsArgs.java
public class ShoppingItemsArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/ShoppingListItemsDirections 4.java:16: error: class ShoppingListItemsDirections is public, should be declared in a file named ShoppingListItemsDirections.java
public class ShoppingListItemsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/StatisticsBalanceDirections 7.java:9: error: class StatisticsBalanceDirections is public, should be declared in a file named StatisticsBalanceDirections.java
public class StatisticsBalanceDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/DebtsLentDirections 5.java:16: error: class DebtsLentDirections is public, should be declared in a file named DebtsLentDirections.java
public class DebtsLentDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/ShoppingListItemsArgs.java:13: error: duplicate class: com.umbrella.budgetapp.Layouts.Fragments.ShoppingListItemsArgs
public class ShoppingListItemsArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/ShoppingListsDirections 4.java:17: error: class ShoppingListsDirections is public, should be declared in a file named ShoppingListsDirections.java
public class ShoppingListsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalDetailsArgs 5.java:13: error: class GoalDetailsArgs is public, should be declared in a file named GoalDetailsArgs.java
public class GoalDetailsArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalDetailsDirections.java:9: error: duplicate class: com.umbrella.budgetapp.Layouts.Fragments.GoalDetailsDirections
public class GoalDetailsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/StatisticsCashflowDirections 4.java:9: error: class StatisticsCashflowDirections is public, should be declared in a file named StatisticsCashflowDirections.java
public class StatisticsCashflowDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/StoresDirections 4.java:16: error: class StoresDirections is public, should be declared in a file named StoresDirections.java
public class StoresDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/IconsDirections.java:9: error: duplicate class: com.umbrella.budgetapp.Layouts.Fragments.IconsDirections
public class IconsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/Fragments/GoalsPausedDirections.java:16: error: duplicate class: com.umbrella.budgetapp.Layouts.Fragments.GoalsPausedDirections
public class GoalsPausedDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateUserProfileDirections 10.java:8: error: class UpdateUserProfileDirections is public, should be declared in a file named UpdateUserProfileDirections.java
public class UpdateUserProfileDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateDebtDirections 4.java:9: error: class UpdateDebtDirections is public, should be declared in a file named UpdateDebtDirections.java
public class UpdateDebtDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateAccountDirections 4.java:9: error: class UpdateAccountDirections is public, should be declared in a file named UpdateAccountDirections.java
public class UpdateAccountDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateCategoryArgs 6.java:13: error: class UpdateCategoryArgs is public, should be declared in a file named UpdateCategoryArgs.java
public class UpdateCategoryArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateCategoryDirections 4.java:9: error: class UpdateCategoryDirections is public, should be declared in a file named UpdateCategoryDirections.java
public class UpdateCategoryDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateGoalDetailsDirections 9.java:8: error: class UpdateGoalDetailsDirections is public, should be declared in a file named UpdateGoalDetailsDirections.java
public class UpdateGoalDetailsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateGoalDetailsDirections 10.java:8: error: class UpdateGoalDetailsDirections is public, should be declared in a file named UpdateGoalDetailsDirections.java
public class UpdateGoalDetailsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdatePlannedPaymentArgs 8.java:13: error: class UpdatePlannedPaymentArgs is public, should be declared in a file named UpdatePlannedPaymentArgs.java
public class UpdatePlannedPaymentArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateGoalDetailsArgs 8.java:14: error: class UpdateGoalDetailsArgs is public, should be declared in a file named UpdateGoalDetailsArgs.java
public class UpdateGoalDetailsArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateCurrencyDirections 7.java:9: error: class UpdateCurrencyDirections is public, should be declared in a file named UpdateCurrencyDirections.java
public class UpdateCurrencyDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateTemplateArgs 7.java:13: error: class UpdateTemplateArgs is public, should be declared in a file named UpdateTemplateArgs.java
public class UpdateTemplateArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdatePlannedPaymentArgs 9.java:13: error: class UpdatePlannedPaymentArgs is public, should be declared in a file named UpdatePlannedPaymentArgs.java
public class UpdatePlannedPaymentArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateGoalDetailsArgs 9.java:14: error: class UpdateGoalDetailsArgs is public, should be declared in a file named UpdateGoalDetailsArgs.java
public class UpdateGoalDetailsArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateDebtDirections.java:9: error: duplicate class: com.umbrella.budgetapp.Layouts.UpdateFragments.UpdateDebtDirections
public class UpdateDebtDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateGoalSelectDirections 9.java:16: error: class UpdateGoalSelectDirections is public, should be declared in a file named UpdateGoalSelectDirections.java
public class UpdateGoalSelectDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateStoreArgs 7.java:13: error: class UpdateStoreArgs is public, should be declared in a file named UpdateStoreArgs.java
public class UpdateStoreArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateAccountArgs 7.java:13: error: class UpdateAccountArgs is public, should be declared in a file named UpdateAccountArgs.java
public class UpdateAccountArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdatePlannedPaymentDirections 7.java:9: error: class UpdatePlannedPaymentDirections is public, should be declared in a file named UpdatePlannedPaymentDirections.java
public class UpdatePlannedPaymentDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateUserProfileDirections 8.java:8: error: class UpdateUserProfileDirections is public, should be declared in a file named UpdateUserProfileDirections.java
public class UpdateUserProfileDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateRecordDetailsDirections 9.java:8: error: class UpdateRecordDetailsDirections is public, should be declared in a file named UpdateRecordDetailsDirections.java
public class UpdateRecordDetailsDirections {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateDebtArgs 9.java:13: error: class UpdateDebtArgs is public, should be declared in a file named UpdateDebtArgs.java
public class UpdateDebtArgs implements NavArgs {
^
/Users/XX/Documents/AndroidStudio/Projects/BudgetApp/app/build/generated/source/navigation-args/debug/com/umbrella/budgetapp/Layouts/UpdateFragments/UpdateShoppingListDirections 9.java:9: error: class UpdateShoppingListDirections is public, should be declared in a file named UpdateShoppingListDirections.java
public class UpdateShoppingListDirections {
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors
> Task :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.

转到菜单并选择:构建 -> 清理项目,完成后,构建 -> 重建项目

如果单击"生成"->"清理项目"或"重新生成项目"无法解决问题,则应该有另一个问题导致生成失败。修复其他问题,重建可能会成功。

还要检查包中是否存在真正的 BuildConfig 文件,将其删除并重试。

您可能已经创建了相同名称和类型的重复Java文件,请检查并删除一个。

相关内容

  • 没有找到相关文章

最新更新