2016-08-11 6 views
0

Eclipseでgradlleを使用したプロジェクトがあります。
私はphysicaデバイス上でプロジェクトを実行したいですが、そのオプションが表示されません。Gradleを含むEclipseにプロジェクトをデバイスにデプロイ

実行タブを選択すると、プロジェクトはgradleを実行します。

チェック build.gradleファイルの下

apply plugin: 'java' 
repositories { 
    jcenter() 
} 

dependencies { 
    compile 'org.slf4j:slf4j-api:1.7.21' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 

    testCompile 'junit:junit:4.12' 
    compile files ('libs/twitter4j-core-4.0.4.jar') 
    compile files ('libs/gson-2.2.2.jar') 
    compile files ('libs/agilio_rtmp-debug.jar') 
    compile files ('libs/facebook-android-sdk-4.14.1.jar') 
    compile files ('libs/agilio_rtmp-debug.jar') 
} 

私は、実行を選択すると:
enter image description here

+0

Gradleには、「app:installDebug」タスクがあります。あなたはそれを見ない? –

+0

私はそれを見ない。それはどこにある? – kaka

+0

あなたの質問をあなたのGradleファイルで編集してください。 –

答えて

0

私は物理デバイス上でプロジェクトを実行します。

目的のタスクはapp:installDebugですが、これは正しいプロジェクト構造を持っていることを前提としています。


あなたのプロジェクトが持つ構造は、ここにAndroid Gradle documentationから推奨構造が何であるかは明らかではありませんので。

settings.gradle 
build.gradle   # Top-level 
app/     # A module named 'app' 
    build.gradle   # Module-level 
    libs/ 
    library-1.jar 
    library-2.jar 
    ... 
    src/main/ 
    AndroidManifest.xml 
    java/    # application package in here, then Java files in that 
    res/ 

これは、ここでsettings.gradle

include ':app' 

では、あなたの依存関係の調整とトップレベルbuild.gradle

その後
buildscript { 

    repositories { 
     jcenter() 
    } 

    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.2' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

モジュールbuild.gradleです。

最も重要なのは、ここのトップラインは、GradleにJavaアプリではなくAndroidアプリだと伝えています。これは、あなたが探しているものであるinstallDebugのようなさまざまなAndroid関連のGradleタスクを実行できることを意味します。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     applicationId "xxxxxxxx" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

ext { 
    // Variables to keep libraries consistent 
    supportLibrary = '23+' 

    // Support Libraries dependencies 
    supportDependencies = [ 
      design   :   "com.android.support:design:${supportLibrary}", 
      appCompatV7  :   "com.android.support:appcompat-v7:${supportLibrary}" 
    ] 

} 

dependencies { 
    compile 'org.slf4j:slf4j-api:1.7.21' 

    // This line already compiles all jar files in the libs/ directory 
    compile fileTree(dir: 'libs', include: ['*.jar']) 

    testCompile 'junit:junit:4.12' 

    // recommended 
    compile supportDependencies.design 
} 
関連する問題