Java 无法解决类上的符号错误-Android Studio

Java 无法解决类上的符号错误-Android Studio,java,android,class,Java,Android,Class,我是新来的,所以请容忍我 我在类上遇到无法解析符号错误 我有一门课程,名为CameraPhotoActivity(以下简称CameraPhotoActivity): 下面这一节是我遇到问题的地方: @Override public void onClick(View view) { startActivity(new Intent(getApplicationContext().UploadInfo.class)); } “UploadInfo.class

我是新来的,所以请容忍我

我在类上遇到无法解析符号错误

我有一门课程,名为CameraPhotoActivity(以下简称CameraPhotoActivity):

下面这一节是我遇到问题的地方:

@Override
     public void onClick(View view) {
         startActivity(new Intent(getApplicationContext().UploadInfo.class));
     }
“UploadInfo.class”上出现错误

这表明我没有一个名为“UploadInfo”的类,但正如您在下面看到的,我有:

package com.example.android.frapp;

import android.app.ProgressDialog;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.firebase.client.Firebase;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.storage.StorageReference;

public class UploadInfo extends AppCompatActivity {

Button selectImageBtn, uploadButton;
ImageView user_image;
TextView title;
public static final int READ_EXTERNAL_STORAGE = 0;
public static final int GALLERY_INTENT = 2;
private ProgressDialog mProgressDialog;
private Firebase mRoofRef;
private Uri mImageUri = null;
private DatabaseReference mDatabaseRef;
private StorageReference mStorage;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.uploading_layout);

    Firebase.setAndroidContext(this);

    selectImageBtn = (Button) findViewById(R.id.selectImageBtn);
    uploadButton = (Button) findViewById(R.id.uploadButton);
    user_image = (ImageView) findViewById(R.id.user_image);
    title = (TextView) findViewById(R.id.etTitle);

    // inititalise the progress bar
    mProgressDialog = new ProgressDialog(UploadInfo.this);

    }
}
下面是清单文件,您将看到我在其中添加了“UploadInfo”类:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.frapp">

<uses-feature android:name="android.hardware.camera2" android:required="true"></uses-feature>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>

<application
    android:name=".FireApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".SplashActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainLoginActivity" />
    <activity android:name=".MainActivity" />
    <activity
        android:name=".Login"
        android:label="@string/title_activity_login"
        android:theme="@style/AppTheme" />
    <activity
        android:name=".LoginScreenActivity"
        android:label="@string/title_activity_login_screen"
        android:parentActivityName=".MainActivity"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.android.frapp.MainActivity" />
    </activity>
    <activity
        android:name=".CreateCaseActivity"
        android:label="@string/title_activity_create_case"
        android:theme="@style/AppTheme" />
    <activity
        android:name=".NoteTakerActivity"
        android:label="@string/title_activity_note_taker"
        android:theme="@style/AppTheme" />
    <activity android:name=".AddMainNotesActivity"></activity>
    <activity android:name=".CameraPhotoActivity"></activity>
    <activity android:name=".CameraVideoActivity"></activity>
    <activity android:name=".AudioActivity"></activity>
    <activity android:name=".UploadInfo"></activity>
</application>
我尝试了以下方法:

  • 项目的清理和重建
  • 文件>使缓存无效/重新启动>使缓存无效并重新启动
  • 将项目与坡度文件同步
  • 关闭项目,关闭Android Studio并从备份导入项目
  • 我甚至尝试删除我创建的类,并通过出现错误的行中给出的选项重新创建它,但它做的是相同的事情
  • 我希望我没有遗漏一些显而易见的东西,但我所尝试的一切都是基于我从以前的答案中看到的


    请帮助将行更改为:

    startActivity(new Intent(CameraPhotoActivity.this , UploadInfo.class));
    

    成功了。我知道这很简单。我早该知道的。我觉得现在问这个问题很愚蠢好吧点击勾号接受我的答案!还有一个逻辑是,你没有用逗号(,),而是用了一个点(.)。甚至getApplication也可以工作。好吧,接受答案,因为你问了,只有你能接受。堆栈溢出样式@Padamso毕竟这实际上是因为我放了一个点而不是逗号?该死的。现在我感觉更傻了哦,一点问题都没有,我们都有这样的时刻,我记得我在stackoverflow中的第一个问题是我忘记了右括号
    }
    。哈哈哈,很好,再次感谢你。我只花了大约一个小时来修复它,现在把你的logcat错误信息都整理好了。无论如何谢谢你
    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.android.frapp"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
    
    }
    
    
    
    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.google.firebase:firebase-messaging:11.6.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.google.firebase:firebase-database:11.6.2'
    compile 'com.google.firebase:firebase-crash:11.6.2'
    compile 'com.google.firebase:firebase-auth:11.6.2'
    compile 'com.google.firebase:firebase-storage:11.6.2'
    compile 'com.firebase:firebase-client-android:2.5.2'
    compile 'com.google.firebase:firebase-core:11.6.2'
    compile 'com.firebaseui:firebase-ui-storage:1.2.0'
    compile 'com.firebaseui:firebase-ui-database:1.2.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.support:cardview-v7:27.0.2'
    compile 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    
    // Firebase UI
    compile 'com.firebaseui:firebase-ui-database:3.1.2'
    compile 'com.android.support:recyclerview-v7:27.0.2'
    }
    apply plugin: 'com.google.gms.google-services'
    
    startActivity(new Intent(CameraPhotoActivity.this , UploadInfo.class));