我已經收到了兩天的錯誤,至今沒有任何工作嘗試過。錯誤:Gradle:執行失敗,執行任務':androidLib:compileDebugJavaWithJavac'。 >編譯失敗;有關詳細信息,請參閱編譯器錯誤輸出
我清理了它,重建了它,使緩存失效,更新了Android Studio及其構建工具,但絕對沒有任何效果。我的JAVA_HOME很好,SDK很好。我查了一切,但它似乎並沒有工作。
androidLib是一個庫我使用,它是這樣的
androidLib包含了幾乎所有我的依賴 模板常見的就是我創建了一個模塊,它具有androidLib作爲一個依賴(被包含在它的設置.gradle及其各自的版本) 模板是我的項目,它具有模板通用作爲依賴,因此它也有androidLib以及
但它不斷給我這個錯誤,根本沒有任何androidLib依賴項被訪問,包括應用程序緊湊和事情等。
這是androidLib gradle這個
apply plugin: 'com.android.library'
dependencies {
compile('io.socket:socket.io-client:0.7.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-rest- template:1.0.1.RELEASE'
compile 'com.vividsolutions:jts:1.13'
compile 'com.noveogroup.android:android-logger:1.3.5'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
}
這是模板的gradle共同
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'net.xpece.material:navigation-drawer:[email protected]'
compile 'com.isseiaoki:simplecropview:1.0.13'
compile 'com.stripe:stripe-android:+'
compile 'io.card:android-sdk:5.1.2'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.helpshift:android-aar:4.2.0-support'
compile 'com.github.jd-alexander:library:1.0.8'
compile project(':androidLib')
}
而這個IT項目gradle這個
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "br.com.altranais.template"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
productFlavors {
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':templatecommon')
}
搖籃控制檯
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :androidLib:generateDebugSources, :androidLib:generateDebugAndroidTestSources, :androidLib:prepareDebugUnitTestDependencies, :androidLib:mockableAndroidJar, :androidLib:compileDebugSources, :androidLib:compileDebugAndroidTestSources, :androidLib:compileDebugUnitTestSources, :templatecommon:generateDebugSources, :templatecommon:prepareDebugUnitTestDependencies, :templatecommon:mockableAndroidJar, :templatecommon:generateDebugAndroidTestSources, :templatecommon:compileDebugSources, :templatecommon:compileDebugUnitTestSources, :templatecommon:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:clean
:androidLib:clean
:app:clean UP-TO-DATE
:templatecommon:clean UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:androidLib:preBuild UP-TO-DATE
:androidLib:preReleaseBuild UP-TO-DATE
:androidLib:compileReleaseNdk UP-TO-DATE
:androidLib:compileLint
:androidLib:copyReleaseLint UP-TO-DATE
:androidLib:checkReleaseManifest
:androidLib:preDebugAndroidTestBuild UP-TO-DATE
:androidLib:preDebugBuild UP-TO-DATE
:androidLib:preDebugUnitTestBuild UP-TO-DATE
:androidLib:preReleaseUnitTestBuild UP-TO-DATE
:androidLib:prepareComAndroidSupportAnimatedVectorDrawable2330Library
:androidLib:prepareComAndroidSupportAppcompatV72330Library
:androidLib:prepareComAndroidSupportCardviewV72330Library
:androidLib:prepareComAndroidSupportDesign2330Library
:androidLib:prepareComAndroidSupportMediarouterV72300Library
:androidLib:prepareComAndroidSupportMultidex101Library
:androidLib:prepareComAndroidSupportRecyclerviewV72330Library
:androidLib:prepareComAndroidSupportSupportV42330Library
:androidLib:prepareComAndroidSupportSupportVectorDrawable2330Library
:androidLib:prepareComGoogleAndroidGmsPlayServices840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesAds840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesAppstate840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesAuth840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesBase840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesCast840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesDrive840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesFitness840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesGames840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesGcm840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesIdentity840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesLocation840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesMaps840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesNearby840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesPanorama840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesPlus840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesVision840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesWallet840Library
:androidLib:prepareComGoogleAndroidGmsPlayServicesWearable840Library
:androidLib:prepareReleaseDependencies
:androidLib:compileReleaseAidl
:androidLib:compileReleaseRenderscript
:androidLib:generateReleaseBuildConfig
:androidLib:generateReleaseAssets UP-TO-DATE
:androidLib:mergeReleaseAssets
:androidLib:generateReleaseResValues UP-TO-DATE
:androidLib:generateReleaseResources
:androidLib:mergeReleaseResources
:androidLib:processReleaseManifest
:androidLib:processReleaseResources
:androidLib:generateReleaseSources
:androidLib:compileReleaseJavaWithJavac
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:23: error: cannot find symbol
public class AISActivity extends ActionBarActivity {
^
symbol: class ActionBarActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:29: error: cannot find symbol
protected DrawerLayout drawerLayout;
^
symbol: class DrawerLayout
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:36: error: cannot find symbol
protected ActionBarDrawerToggle actionBarDrawerToggle;
^
symbol: class ActionBarDrawerToggle
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:42: error: cannot find symbol
super.onCreate(savedInstanceState);
^
symbol: variable super
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:43: error: cannot find symbol
setContentView(R.layout.activity_ais);
^
symbol: variable activity_ais
location: class layout
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:40: error: method does not override or implement a method from a supertype
@Override
^
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:51: error: cannot find symbol
frameLayout = (FrameLayout)findViewById(R.id.content_frame);
^
symbol: variable content_frame
location: class id
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:52: error: cannot find symbol
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
^
symbol: class DrawerLayout
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:52: error: cannot find symbol
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
^
symbol: variable drawer_layout
location: class id
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:53: error: cannot find symbol
drawerList = (ListView) findViewById(R.id.left_drawer);
^
symbol: variable left_drawer
location: class id
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:54: error: cannot find symbol
titles = getResources().getStringArray(R.array.titles);
^
symbol: method getResources()
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:55: error: cannot find symbol
images = getResources().obtainTypedArray(R.array.images);
^
symbol: method getResources()
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:56: error: cannot find symbol
activities = getResources().getStringArray(R.array.activities);
^
symbol: method getResources()
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:57: error: cannot find symbol
textCurrentUser = (TextView)drawerLayout.findViewById(R.id.user_name);
^
symbol: variable user_name
location: class id
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:58: error: cannot find symbol
imageFotoView = (ImageView) findViewById(R.id.fotoView);
^
symbol: variable fotoView
location: class id
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:59: error: cannot find symbol
actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.loading,R.string.loading){
^
symbol: class ActionBarDrawerToggle
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:87: error: cannot find symbol
super.onDestroy();
^
symbol: variable super
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:85: error: method does not override or implement a method from a supertype
@Override
^
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:95: error: no suitable method found for makeText(AISActivity,String,int)
Toast.makeText(AISActivity.this, message, Toast.LENGTH_LONG).show();
^
method Toast.makeText(Context,int,int) is not applicable
(actual argument AISActivity cannot be converted to Context by method invocation conversion)
method Toast.makeText(Context,CharSequence,int) is not applicable
(actual argument AISActivity cannot be converted to Context by method invocation conversion)
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:92: error: cannot find symbol
this.runOnUiThread(new Runnable() {
^
symbol: method runOnUiThread(<anonymous Runnable>)
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:102: error: cannot find symbol
Log.d(getClass().getSimpleName(), obj == null ? "NULL" : obj.toString());
^
symbol: method getClass()
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:106: error: cannot find symbol
Log.e(getClass().getSimpleName(), obj == null ? "NULL" : obj.toString(), tr);
^
symbol: method getClass()
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:110: error: cannot find symbol
View view = findViewById(id);
^
symbol: method findViewById(int)
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:131: error: cannot find symbol
this.showProgressDialog(getString(R.string.loading));
^
symbol: method getString(int)
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:136: error: no suitable constructor found for ProgressDialog(AISActivity)
progressDialog = new ProgressDialog(this);
^
constructor ProgressDialog.ProgressDialog(Context,int) is not applicable
(actual and formal argument lists differ in length)
constructor ProgressDialog.ProgressDialog(Context) is not applicable
(actual argument AISActivity cannot be converted to Context by method invocation conversion)
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:151: error: no suitable constructor found for Builder(AISActivity)
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
^
constructor Builder.Builder(Context,int) is not applicable
(actual and formal argument lists differ in length)
constructor Builder.Builder(Context) is not applicable
(actual argument AISActivity cannot be converted to Context by method invocation conversion)
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:165: error: cannot find symbol
super.onPostCreate(savedInstanceState);
^
symbol: variable super
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:163: error: method does not override or implement a method from a supertype
@Override
^
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:171: error: cannot find symbol
super.onConfigurationChanged(newConfig);
^
symbol: variable super
location: class AISActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISActivity.java:169: error: method does not override or implement a method from a supertype
@Override
^
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISNavigationActivity.java:28: error: cannot find symbol
navigationDrawerAdapter = new AISNavigationDrawerAdapter(getApplicationContext(), titles, images);
^
symbol: method getApplicationContext()
location: class AISNavigationActivity
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISNavigationActivity.java:36: error: cannot find symbol
drawerLayout.closeDrawer((LinearLayout) findViewById(R.id.left_container));
^
symbol: variable left_container
location: class id
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/activity/AISNavigationActivity.java:37: error: cannot find symbol
onActivityInteractionListener.openActivityInteraction(getApplicationContext(),position);
^
symbol: method getApplicationContext()
location: class AISNavigationActivity.DrawerItemClickListener
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/adapters/AISNavigationDrawerAdapter.java:52: error: package R does not exist
view = inflater.inflate(R.layout.drawer_list_item, null);
^
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/adapters/AISNavigationDrawerAdapter.java:53: error: package R does not exist
TextView txt=(TextView)view.findViewById(R.id.section_label);
^
/Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/adapters/AISNavigationDrawerAdapter.java:57: error: package R does not exist
ImageView imageView = (ImageView)view.findViewById(R.id.icon_list);
^
Note: /Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/adapters/AISNavigationDrawerAdapter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/Leonardo/Documents/Android/androidLib/src/main/java/br/com/altranais/lib/socket/SocketClient.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
36 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':androidLib:compileReleaseJavaWithJavac'.
> 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: 23.847 secs
感謝
請在Gradle輸出中添加錯誤消息。 – Michael
幾乎所有的錯誤都是因爲lib沒有被訪問 –