我是android编程的新手。 这是我尝试运行的简单程序。如果发布位置不正确,请随时忽略。该程序取自here
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class AppleFragment extends Fragment {
public AppleFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_apple, container, false);
}
}
Iam使用android compileSdkVersion 29和buildToolsVersion“ 29.0.2”。这是我的buid.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.abhiandroid.viewpagerexample.myapplication"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.androidx.support', module: 'support-annotations'
})
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'junit:junit:4.12'
}
我正在使用
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'.
请帮助我为什么我会收到这些错误
错误:找不到符号类片段
错误:找不到符号类片段
错误:方法未覆盖或从超类型实现方法
错误:找不到符号变量super
错误:方法未从超类型