2016-10-28 35 views
1

私はコードを生成し、いくつかの新しいgradleタスクを注入するカスタムgradleプラグインを作成しています。私の問題は現在gradlew checkにあります。compileReleaseJavaWithJavacまたはcompileDebugJavaWithJavacというタスクは失敗します。gradleタスクのデバッグcompileReleaseJavaWithJavac

Windowsでは、タスクが正常に実行されます.LinuxとMacでは、タスクは失敗します。これは、パスまたはディレクトリ区切りにエラーがあることを示唆している可能性があります。ここで

は、正確なエラーです:

:examples:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). 
/the/full/path/to/file/MainActivity.java:10: error: package R does not exist 
     setContentView(R.layout.activity_main); 
         ^
1 error 

私の質問は、私は特別なタスクことをデバッグすることができますどのようになりましたでしょうか?クラスパスを見たいのですが、何か間違っていると思います。

あなたは言う前に、ちょっとRファイルが生成されていません。:これはです。ファイルシステム内のファイルが表示されます。

Macで並列タスクを無効にするともう少し演奏していましたが、これもうまくコンパイルできます。しかしトラビスではまだ失敗する。

+0

あなたのtravis.ymlコンテンツを質問またはファイルへのリンクに追加してください。 – albodelu

+1

@ardockはこちらです:https://github.com/rekire/PojoBooster/blob/d6b51c81191ecb99017585a28764bb7793da3afe/.travis.yml – rekire

答えて

1

更新応答:

は現在、私は知っている:

  • それはトラヴィス-CIの問題ではない私は、Linux マシン上でローカルにそれを再現しているため。
  • Rパッケージには関係なく、デフォルトのパッケージであり、インポートは不要です。
  • これはappcompatエラーとは関係ありません。ランダムな変更でビルドは成功します。
  • インクリメンタルビルドに関連するもの、see this、またthisと思われ、それをfalseに設定しようとします。

Story: Don't compile a source file when the API of its compile dependencies has not changed

Currently, changing the body of a method invalidates all class files that have been compiled against the method's class. Instead, only the method's class should be recompiled. Similarly, changing a resource file invalidates all class files that included that resource file in the compile classpath. Instead, resource files should be ignored when compiling.

We don't necessarily need a full incremental Java compilation to improve this. For example, the Java compilation task may consider the API of the compile classpath - if it has changed, then compile all source files, and if it has not, skip the task (assuming everything else is up to date). This means that a change to a method body does not propagate through the dependency graph.

最初のビルドにStracktrace誤差(第2成功したビルド):

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':examples:app:compileReleaseJavaWithJavac'. 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) 
... 
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details. 
     at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:48) 

おそらくthis warningJava8またはannotationsが関連しています。私はこれを助けて欲しい、私が行った変更はビルドを成功させ、本当の問題を理解することは難しいので、私は残す。

私はthisのようなJava 8の使用に構成:あなたの本当のパッケージを使用してMainActivity.javaに次のインポートを追加してみ

import your.package.R; 

R

android { 
    ... 
    defaultConfig { 
    ... 
    jackOptions { 
     enabled true 
    } 
    } 
    compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
    } 
} 

前の応答を次のような以前のエラーのためにファイルが正しく生成されません:

COMPILE-Error: package android.support.v7.app does not exist 

私はそれをテストしました。私はあなたのプロジェクトをLinuxマシンにダウンロードしました(これはtravis-ciの問題ではありません)。

私は次の行で依存関係を置き換え、それが動作します:

compile "com.android.support:appcompat-v7:25.0.0" 

だから私はあなたが{ }を追加することをお勧め:

compile "com.android.support:appcompat-v7:${project.supportLibVersion}" 

今、それは常に働いて本当に、私は、わからないんだけど提案された変更はありません。

おそらく、パラレルオプションの問題で、2回目の実行には当てはまりましたが、近いうちです。

関連する問題