2017-06-10 43 views
-5

當我嘗試運行我的應用程序錯誤:(30,16)錯誤:無法找到符號類的setContentView

> `Error:(30, 16) error: cannot find symbol class SetContentView` 
Error:(68, 24) error: cannot find symbol class SetContentView 
Error:(100, 33) error: cannot find symbol class SetContentView 
Error:Execution failed for task ':app:compileDebugJavaWithJavac'. 
> Compilation failed; see the compiler error output for details. 

每次我試圖運行它,我得到這個錯誤我得到這個錯誤 這是我的gradle這個文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.3" 

    defaultConfig { 
     applicationId "com.jungleadventureninja.game" 
     minSdkVersion 14 
     targetSdkVersion 23 

     ndk { 
      moduleName "player_shared" 
     } 
    } 

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

dependencies { 
    compile 'com.android.support:support-v4:25.2.0' 
    compile 'com.google.android.gms:play-services:+' 
    compile files('libs/dagger-1.2.2.jar') 
    compile files('libs/javax.inject-1.jar') 
    compile files('libs/nineoldandroids-2.4.0.jar') 
} 

` 

林在Android Studio中新..任何一個可以幫助我.. TX 注:這個程序是一個Eclipse應用..但我沒有打開它的AS,因爲它要好得多

+2

使用'setContentView()'而不是'SetContentView()'在你的活動類 – Shashanth

+0

它們之間有什麼不同? –

+1

駱駝駝峯'setContentView()'以小寫's'開始。 – Shashanth

回答

0

爲了設置視圖,你需要使用setContentView()方法而不是SetContentView這個編譯器解釋爲不存在的類。

+0

你能不能告訴我如何做到這一點.. ..即時新的AS,我不知道如何做到這一點.. tx –

+0

在你的MainActivity(我假設你使用默認名稱)你有onCreate()方法,在該方法內部使用'setContentView(R.layout.your_layout_file)' – Tuby