我尝试解决这个问题超过5个小时。可能是什么问题?
override func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
if let selectedRow = tableView.indexPathForSelectedRow {
print("Deselecting row \(selectedRow.row). Stop playing sound")
audioPlayer.stopPlaying()
tableView.deselectRow(at: indexPath, animated: false)
if selectedRow == indexPath {
return nil
}
}
print("Selecting row \(indexPath.row). Start playing sound")
playSong(song: songs[indexPath.row], selectedItemIndex: selectedItemIndex!)
return indexPath
}
我添加了:
org.gradle.configureondemand = true
但是问题仍然存在
build.gradle(模块:应用)
Circular dependency between the following tasks:
:app:checkManifestChangesDevelopDebug
\--- :app:instantRunMainApkResourcesDevelopDebug
\--- :app:transformClassesAndDexWithShrinkResForDevelopDebug
\--- :app:transformDexArchiveWithDexMergerForDevelopDebug
+--- :app:preColdswapDevelopDebug
| \--- :app:incrementalDevelopDebugTasks
| +--- :app:transformClassesAndClassesEnhancedWithInstantReloadDexForDevelopDebug
| | \--- :app:transformClassesWithInstantRunForDevelopDebug
| | \--- :app:checkManifestChangesDevelopDebug (*)
| \--- :app:transformClassesWithInstantRunForDevelopDebug (*)
\--- :app:transformClassesWithDexBuilderForDevelopDebug
+--- :app:preColdswapDevelopDebug (*)
\--- :app:transformClassesWithInstantRunForDevelopDebug (*)
(*) - details omitted (listed previously)
和build.gradle(项目:myproject)
//顶级构建文件,您可以在其中添加常见的配置选项 所有子项目/模块。
buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'realm-android' repositories { maven { url 'https://maven.fabric.io/public' } } static def getFullDate() { return new Date().format('dd.MM.yyyy-HH.mm') } static def getDate() { return new Date().format('dd.MM.yyyy') } android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion '28.0.2' defaultConfig { applicationId "com.MYPROJECT" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 47 versionName "2.11d" // project.ext.set("archivesBaseName", "MYPROJECT_" + versionName + "_" + getFullDate()) project.ext.set("archivesBaseName", "MYPROJECT_" + versionName + "_" + getDate()) vectorDrawables.useSupportLibrary = true multiDexEnabled true externalNativeBuild { cmake { cppFlags "-std=c++11" } } } buildTypes { debug { minifyEnabled true useProguard true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } externalNativeBuild { cmake { path "CMakeLists.txt" } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } flavorDimensions "app" productFlavors { prod { buildConfigField 'String', 'SERVER_BASE_URL', '"http://MYPROJECT.com/"' dimension "app" } develop { buildConfigField 'String', 'SERVER_BASE_URL', '"http://MYPROJECT.com/"' buildConfigField 'String', 'YOUTUBE_API_KEY', '"AIzaSyD5eJIAcqUtMkBoorw_K8mh1d_TQSgjRwMT"' applicationIdSuffix = ".dev" versionNameSuffix = "-dev" dimension "app" } } dexOptions { } } dependencies { implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion" annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion" implementation fileTree(include: ['*.jar'], dir: 'libs') implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true } //Google Supports implementation "com.android.support:design:$rootProject.supportLibraryVersion" implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion" implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" implementation "com.android.support:preference-v7:$rootProject.supportLibraryVersion" //Network implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion" implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion" implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion" implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpVersion" //Constraint layout implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion" //Google services implementation "com.google.android.gms:play-services-maps:$rootProject.googleServiceVersion" implementation "com.google.android.gms:play-services-location:$rootProject.googleServiceVersion" implementation "com.google.android.gms:play-services-gcm:$rootProject.googleServiceVersion" //RxJava implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjavaVersion" implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion" //Lifecycle implementation "android.arch.lifecycle:runtime:$project.lifecycleVersion" implementation "android.arch.lifecycle:extensions:$project.lifecycleVersion" implementation "android.arch.lifecycle:viewmodel:$project.lifecycleVersion" annotationProcessor "android.arch.lifecycle:compiler:$project.lifecycleVersion" //Dagger dependencies implementation "com.google.dagger:dagger:$rootProject.daggerVersion" implementation "com.google.dagger:dagger-android:$rootProject.daggerVersion" implementation "com.google.dagger:dagger-android-support:$rootProject.daggerVersion" annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.daggerVersion" //RxPermissions implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar' //RxBinding implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1' //TIMBER //implementation 'com.jakewharton.timber:timber:4.7.0' testImplementation "junit:junit:$rootProject.junitVersion" //Glide implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion" annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion" implementation files('src/main/jniLibs/aacdecoder-android-0.8.jar') //Youtube implementation files('libs/YouTubeAndroidPlayerApi.jar') //Vitamio video player //implementation project(':vitamio') //VideoPlayer implementation 'cn.jzvd:jiaozivideoplayer:6.2.12' implementation 'org.greenrobot:eventbus:3.1.1' implementation 'com.github.splatte:ViewPagerIndicator:3.0.0' implementation 'com.h6ah4i.android.tablayouthelper:tablayouthelper:0.7.0' //Rate App implementation 'com.github.hotchemi:android-rate:1.0.1' implementation 'de.hdodenhof:circleimageview:2.2.0' implementation 'com.github.vbartacek:aacdecoder-android:0.8' implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.11' implementation 'com.github.arimorty:floatingsearchview:2.1.1' implementation 'jp.wasabeef:glide-transformations:3.2.0' implementation 'org.adw.library:discrete-seekbar:1.0.1' implementation 'com.android.support:multidex:1.0.3' //RouteController implementation 'com.ncapdevi:frag-nav:3.0.0-RC3' //Joda Time implementation 'net.danlew:android.joda:2.9.9.4' //ReactLocation implementation 'pl.charmas.android:android-reactive-location2:2.1@aar' //SeekBar implementation 'com.xw.repo:bubbleseekbar:3.16-lite' //Lombok //Warning! Versions above 1.16.20 do not work with lambda (throws an exception when compiling) compileOnly "org.projectlombok:lombok:$rootProject.lombokVersion" annotationProcessor "org.projectlombok:lombok:$rootProject.lombokVersion" //nv-websocket-client implementation "com.neovisionaries:nv-websocket-client:$rootProject.nvWebSocketClientVersion" //Custom tabs implementation "com.android.support:customtabs:$rootProject.supportLibraryVersion" //Auto scroll view pager for Suggestion implementation("cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:$rootProject.autoScrollViewPagerVersion") { exclude module: 'support-v4' } //Paging library implementation "android.arch.paging:runtime:$rootProject.pagingLibraryVersion" //Beacon Library implementation 'org.altbeacon:android-beacon-library:2.15' }
答案 0 :(得分:11)
但是minifyEnabled在生产中很重要。我尝试了以下安排,并且启用了即时运行:
minifyEnabled true
useProguard true
shrinkResources false
因此,当启用即时运行并且将rinkreResources也设置为true时,往往会发生这种情况。
答案 1 :(得分:2)
对于这样的错误:
Circular dependency between the following tasks::app:bundleDebugClasses
\--- :app:compileDebugJavaWithJavac
\--- :package_name:bundleLibCompileToJarDebug
\--- :package_name:compileDebugJavaWithJavac
\--- :app:bundleDebugClasses (*)
发生此错误是因为您在依赖项之间创建了循环。这意味着使用了一个属于另一个的两个 implementations
,因此您应该从 gradles 列表中的 implementation
下方删除额外的 build.gradle
。
另一个例子:
如果 package A 在 package B 中实现,并且你需要将 B 实现放在 A 中,然后你做到了,它会导致这个错误。
答案 2 :(得分:1)
最小化的userProguard收缩资源可以在调试模式下产生错误。这些功能需要在发行版中使用。因此,您需要禁用它们,或者可以添加debuggable = false。
debug {
minifyEnabled true
useProguard true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
答案 3 :(得分:1)
当模块依赖于自身时,就会发生这种情况!
例如,为模块created_at
假设:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Comment;
use App\Image;
class CommentsController extends Controller
{
public function postComment(Request $request){
$userId = $request['userId'];
$imageId = $request['imageId'];
$commentText = $request['comment'];
$image = Image::with('user')->find($imageId);
$comment = new Comment();
$comment->user_id = $userId;
$comment->image_id = $imageId;
$comment->comment = $commentText;
$comment->save();
$image->updateComments();
return response()->json(['comment'=>$comment, 'image'=>$image]);
}
public function deleteComment(Request $request){
$commentId = $request['commentId'];
$comment = Comment::find($commentId);
$comment->delete();
}
}
答案 4 :(得分:0)
我解决了这个问题。只需更换
minifyEnabled true
useProguard true
shrinkResources true
在
minifyEnabled false
useProguard false
shrinkResources false
答案 5 :(得分:0)
我查看了项目结构。(Ctrl + Shift + Alt + S)并删除了导入的模块>同步项目和gradle文件
添加build.gradle Module:app
implementation project(':app')
答案 6 :(得分:0)
您可能会遇到此错误的另一种方式是尝试直接在子模块文件夹中而不是从父项目中构建子模块。
例如您在 ProjectA 中有根项目,在 ProjectA/ProjectB 中有名为 ProjectB 的子模块项目
在 ProjectA/ProjectB/build.gradle
中,您像这样依赖根项目:
dependencies {
implementation rootProject
}
在 ProjectA/settings.gradle
中,您将 ProjectB 作为子项目
rootProject.name = 'ProjectA'
include 'ProjectB'
如果您尝试从 gradlew build
目录中执行 ProjectA/ProjectB/
,您将收到 Circular dependency between the following tasks
错误。
但如果您只是从 gradlew build
目录中获取 ProjectA/
,它应该构建文件并将 ProjectB JAR 输出到 ProjectA/ProjectB/build/libs
文件夹。