我见过一些与此错误相关的类似问题。但我没能解决这个问题。我正在使用 firebase ml 套件来识别图像中的文本。我已将 google-services.json 文件添加到应用程序目录中,但仍然遇到相同的错误。如果有人可以解决这个问题请告诉我。
我收到以下错误:
File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnull\debug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\debug\nullnull\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnull\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\debug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnullDebug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\google-services.json
Run Code Online (Sandbox Code Playgroud)
我的项目的 build.gradle :
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task …Run Code Online (Sandbox Code Playgroud) 我已经尝试了该网站上提供的所有可能的解决方案。我以前使用过改造,并且过去已经解决了这个问题,但这次我无法解决它。我正在使用 StackOverflow API 来获取问题及其详细信息。
\n\n\n \n\n\n
我用来调用的方法:
\n\n @GET\n Call<Item> getAllQuestionsInformation(@Url String url);\nRun Code Online (Sandbox Code Playgroud)\n\n我的带有日志拦截器的改造实例代码:
\n\n String url="https://api.stackexchange.com/2.2/questions?order=asc&sort=votes&site=stackoverflow&tagged=android&filter=withbody/";\n builder=new OkHttpClient.Builder();\n HttpLoggingInterceptor httpLoggingInterceptor=new HttpLoggingInterceptor();\n httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);\n builder.addInterceptor(httpLoggingInterceptor);\n Retrofit retrofit=new Retrofit.Builder()\n .baseUrl(url)\n .addConverterFactory(GsonConverterFactory.create())\n .client(builder.build())\n .build();\n allApiService=retrofit.create(AllApiService.class);\n final Call<Item> itemCall=allApiService.getAllQuestionsInformation(url);\n itemCall.enqueue(new Callback<Item>() {\n @Override\n public void onResponse(Call<Item> call, Response<Item> response) {\n Log.v("Info",""+response.body().getTitle());\n questionTitleArrayList.add(response.body().getTitle());\n }\n\n @Override\n public void onFailure(Call<Item> call, Throwable t) {\n Log.v("Error",""+t.getMessage());\n }\n });\nRun Code Online (Sandbox Code Playgroud)\n\n我收到的错误:
\n\njava.lang.RuntimeException: Unable to start activity ComponentInfo{app.shakil.com.retrofit_paginationrecyclerview/app.shakil.com.retrofit_paginationrecyclerview.MainActivity}: java.lang.IllegalArgumentException: baseUrl must end in /: …Run Code Online (Sandbox Code Playgroud)