Android-firebase问题(“无法解析符号'存储'”)

知识的领域是无限的,我们的学习也是无限期的。这篇文章主要讲述Android-firebase问题:“无法解析符号' 存储' ”相关的知识,希望能为你提供帮助。
[用java为android Studio编写。我试图将Firebase功能的下载内容添加到我的应用程序中,但是尽管添加了相关性和导入功能,但我收到一条错误消息,提示“无法解析符号'存储'”。
这是我的课,我需要下载实现:

import android.os.Bundle; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.OnProgressListener; import com.google.firebase.storage.*; import com.google.firebase.storage.StorageTask; import com.google.firebase.storage.UploadTask; import com.squareup.picasso.Picasso; import androidx.appcompat.app.AppCompatActivity; public class SearchResultPage extends AppCompatActivity {StorageReference storageRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search_result); // Create a storage reference from our app storageRef = storage.getReference(); } }

这是我在gradle中的依赖项:
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.google.android.material:material:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.1.0' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' implementation 'androidx.navigation:navigation-fragment:2.2.2' implementation 'androidx.navigation:navigation-ui:2.2.2' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'com.squareup.picasso:picasso:2.71828' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'com.android.support.test:rules:1.0.2' testImplementation "org.mockito:mockito-core:+" androidTestImplementation "org.mockito:mockito-android:+"implementation 'com.google.firebase:firebase-database:19.3.0' implementation 'com.firebaseui:firebase-ui-database:2.3.0' implementation 'com.google.firebase:firebase-storage:19.1.1'implementation 'com.firebase:firebase-client-android:2.5.0'}

答案【Android-firebase问题(“无法解析符号' 存储' ”)】您的代码尚未定义storage,您必须先定义才能使用它。也许您还想用它来声明它:
FirebaseStorage storage = FirebaseStorage.getInstance();


    推荐阅读