小编Sak*_*ain的帖子

文件 google-services.json 丢失。如果没有它,Google 服务插件就无法运行。(适用于 firebase ml 套件)

我见过一些与此错误相关的类似问题。但我没能解决这个问题。我正在使用 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)

android firebase android-studio firebase-mlkit

5
推荐指数
1
解决办法
1622
查看次数

改造 - 基本 url 必须以 / 结尾

我已经尝试了该网站上提供的所有可能的解决方案。我以前使用过改造,并且过去已经解决了这个问题,但这次我无法解决它。我正在使用 StackOverflow API 来获取问题及其详细信息。

\n\n
\n

API:\n https://api.stackexchange.com/2.2/questions?order=asc&sort=votes&site=stackoverflow&tagged=android&filter=withbody

\n
\n\n

我用来调用的方法:

\n\n
    @GET\n    Call<Item> getAllQuestionsInformation(@Url String url);\n
Run 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        });\n
Run Code Online (Sandbox Code Playgroud)\n\n

我收到的错误:

\n\n
java.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)

api android retrofit retrofit2

5
推荐指数
1
解决办法
6766
查看次数