2017-06-10 40 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