小编Rid*_*dhi的帖子

找不到与com.google.android.gms匹配的任何版本:play-services-base:[15.0.1,16.0.0)

我正在为我的Android应用程序使用firebase,当我试图运行应用程序时突然发现错误.星期六,它工作得很好.我不知道这个错误是怎么发生的以及如何解决这个问题.请帮我.

我的build.gradle中的依赖项

dependencies {
    compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
        transitive = true;
    }
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.google.code.gson:gson:2.8.4'
    compile 'com.android.support:multidex:1.0.3'
    compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
    compile 'com.mixpanel.android:mixpanel-android:4.8.0'
    compile 'com.firebase:firebase-client-android:2.4.0'

    compile 'com.google.firebase:firebase-core:16.0.0'
    compile 'com.google.firebase:firebase-auth:16.0.1'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.github.tibolte:elasticdownload:1.0.+'
    compile 'me.dm7.barcodescanner:zxing:1.8.4'
    compile 'com.google.android.gms:play-services-vision:15.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.1.1'
    compile 'com.github.amlcurran.showcaseview:library:5.4.3'
    compile 'com.wang.avi:library:2.1.3'
    testCompile 'junit:junit:4.12'
    androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.0'
    androidTestCompile 'com.android.support.test:rules:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

在我的项目级build.gradle中:

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:4.0.0'
    }
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

找不到与com.google.android.gms匹配的任何版本:play-services-base:[15.0.1,16.0.0).

android firebase google-play-services

19
推荐指数
4
解决办法
3万
查看次数

Glide显示错误:无法找到GeneratedAppGlideModule

我试图使用滑动加载图像但不知何故我无法使用滑动加载图像.因为它显示以下错误:

无法找到GeneratedAppGlideModule.您应该在com.github.bumptech.glide中包含annotationProcessor编译依赖项:应用程序中的编译器和@GlideModule带注释的AppGlideModule实现或者LibraryGlideModules将被静默忽略.

我也提到了这个解决方案.但是,我已经有了更新的滑行版本.

在我的gradle中,我补充说

implementation 'com.github.bumptech.glide:glide:4.7.1'
Run Code Online (Sandbox Code Playgroud)

annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
Run Code Online (Sandbox Code Playgroud)

XML

<?xml version="1.0" encoding="utf-8"?>

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".view.SettingActivity">

    <data>
        <variable
            name="settingsViewModel"
            type="com.sevenbits.android.mvvmsample.viewmodel.SettingsViewModel"/>

    </data>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/splash_bg">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/profile"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:background="@color/white"
                android:elevation="10dp"
                android:orientation="vertical"
                android:padding="5dp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toTopOf="parent">

                <de.hdodenhof.circleimageview.CircleImageView
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_margin="10dp"
                    app:image_url="@{settingsViewModel.imageUrl}"
                    app:civ_border_width="2dp"
                    app:civ_border_color="@color/colorPrimary"/>

                  ...
            </LinearLayout>

    </android.support.constraint.ConstraintLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

CustomBindingAdapter

public class CustomBindingAdapter {

@BindingAdapter({"bind:image_url"})
public static void loadImage(ImageView imageView, String url) {

    RequestOptions requestOptions = new RequestOptions();
    requestOptions=requestOptions.placeholder(R.drawable.boy_32);

        Glide.with(imageView.getContext())
                .load(url)
                .apply(requestOptions) …
Run Code Online (Sandbox Code Playgroud)

data-binding android android-glide

18
推荐指数
4
解决办法
2万
查看次数

更改离子中所有页面的NavBar颜色

我是离子新手,想要学习它.我的问题是如何更改离子3中所有页面的导航栏颜色.

我一直在使用以下代码

<ion-header>
  <ion-navbar color="primary">
    <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>Hello Ionic</ion-title>
  </ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)

有没有办法改变所有页面的导航栏颜色而不是手动操作 <ion-navbar color="primary">

navbar ionic-framework ionic3

6
推荐指数
1
解决办法
6153
查看次数

在离子中对齐按钮

我正在学习离子,我想在左、中和右对齐我的 3 个按钮。即左侧的第一个按钮,中间的第二个和右侧的第三个。

但我不知道该怎么做?

这是我的代码。

<div>
    <button ion-button icon-left>
            <ion-icon name="home"></ion-icon>
            Left Icon
        </button>

        <button ion-button icon-only>
            <ion-icon name="home"></ion-icon>
        </button>

        <button ion-button icon-right>
            Right Icon
            <ion-icon name="home"></ion-icon>
        </button>
  </div>
Run Code Online (Sandbox Code Playgroud)

任何人都可以指导我吗?因为我是初学者和学习离子。

alignment ionic-framework ionic3

6
推荐指数
1
解决办法
6156
查看次数

Firebase 电话身份验证在活动恢复时显示异常:“短信代码已过期。请重新发送验证码以重试。”

我正在使用 firebase 电话身份验证来验证电话号码。但是,当我尝试切换任何其他应用程序或在进程进行的过程中(即在进程开始和结束之间)按下主页按钮时,会出现问题即使 OTP 正确且时间未过期,它也始终显示FirebaseAuthInvalidCredentialsException以下消息。

短信代码已过期。请重新发送验证码以重试。

以前,我发现当活动在过程中暂停并恢复时,身份验证过程(验证 OTP 或发送 OTP)停止并且不会恢复。因此,为此,我手动启动了该过程。现在,该过程开始但它总是返回上述异常。

通过使用resumeProcess()on Resume 中的方法。现在,receiveOTP()工作正常。但是OTP的验证仍然存在问题。(正如上面所解释的)。

我正在使用对话框进行电话身份验证。

我为电话身份验证和问题编写的代码如下。

手动恢复在暂停时停止的过程。我resumeProcess()onResume().

在片段的 onResume()

@Override
public void onResume() {
    super.onResume();
    if (phoneAuthDialog != null && phoneAuthDialog.isShowing()) {
        phoneAuthDialog.resumeProcess();
    }
}
Run Code Online (Sandbox Code Playgroud)

而且,在对话...

public void resumeProcess(){
    if(isReceivingOtpSms){
        receiveOtp(phoneNumber,null);
    }

    if(isVerifyingOtp){
        verifyOtp();
    }
}
Run Code Online (Sandbox Code Playgroud)

用于接收 OTP。

private void receiveOtp(String phoneNumber,PhoneAuthProvider.ForceResendingToken forceResendingToken) {
    if (connectionDetector != null && connectionDetector.isConnectingToInternet()) {

        setPhoneVerificationCallback();
        isReceivingOtpSms =true;
        showProgress();

        //for receiving …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-authentication

6
推荐指数
1
解决办法
3715
查看次数

如果存在则更新记录,否则在Room中插入新记录

我是Room,Rxjava和其他Android架构组件的新手.我正在尝试更新/插入2条记录(如果行已经存在,请更新它.否则插入一个新行.)我试图按照以下方式进行操作.但是,我没有工作.

GameActivity:

public class GameActivity extends AppCompatActivity {

...

    public void onGameWinnerChanged(Player winner) {


    mDisposable.add(gameViewModel.updateDb(winner)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
            .subscribe(() -> Log.e("Success!!!", "updated records")
                    , throwable -> {
                throwable.printStackTrace();
            }));        
      }
}
Run Code Online (Sandbox Code Playgroud)

GameViewModel:

public class GameViewModel extends ViewModel {

    ...

    public Completable updateDb(Player winner) {

        return Completable.fromAction(() -> {
            updateWinner(winner);
            Player loser = game.player1 == winner ? game.player2 : game.player1;
            updateLoser(loser);
        });
    }

    private void updateLoser(Player loser) {

           User user = userDataSource.getSingleRecordFromName(loser.name);
        if (user != null) {
            user.loss++;
            userDataSource.updateRecord(user);
        } else { …
Run Code Online (Sandbox Code Playgroud)

android android-mvvm rx-java2 android-room

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

如何使用数据绑定请求或删除对edittext的关注

我正在学习mvvm结构,也正在使用mvvm结构制作应用data binding

现在,我想做的是,我想从sharedpreference中获取一个用户,如果成功获取用户,则将usr的名称设置为edittext1。在这种情况下,我想要求重点放在edittext2上

如何使用数据绑定来实现?(以这种方式,我不必使用活动。该工作应仅使用视图模型和xml完成​​。)

我已经尝试使用以下方式。

StartGameViewModel

public class StartGameViewModel extends ViewModel {

    public static String TAG="StartGameViewModel";

    private Preference<User> preference;
    public ObservableField<String> player1Name=new ObservableField<>("");
    public ObservableField<String> player2Name=new ObservableField<>("");

    public ObservableBoolean shouldRequestFocus=new ObservableBoolean(false);


    StartGameViewModel(Preference preference){
        this.preference=preference;
    }

    public void getPreference() {
        preference.get(Constants.CURRENT_USER,User.class)
                .subscribe(new Observer<User>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(User user) {
                        player1Name.set(user.name);
                        shouldRequestFocus.set(true);
                    }

                    @Override
                    public void onError(Throwable e) {
                       Log.i(TAG,"user is logged out");
                    } …
Run Code Online (Sandbox Code Playgroud)

android mvvm android-databinding android-mvvm

5
推荐指数
2
解决办法
2117
查看次数

如何更改离子按钮文本颜色

这可能是一个愚蠢的问题,但我对 ionic 和 css 不太熟悉,所以有人能告诉我如何更改 ionic 按钮的文本颜色吗?

<div class="bottom-button" margin text-center>
     <button ion-button color="energized">
       Register
     </button>
</div>
Run Code Online (Sandbox Code Playgroud)

这里,按钮颜色为黄色,文本颜色为黑色。我想将文本颜色更改为白色。

html css ionic3

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

错误:无法转译程序 Ionic 3

当我尝试运行时出现错误ionic cordova run android

错误:无法转译程序

在新的 BuildError 处(/home/sevenbits/sevenbits-git/androidapplications/IonicBlockchainApp/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)

在/home/sevenbits/sevenbits-git/androidapplications/IonicBlockchainApp/node_modules/@ionic/app-scripts/dist/transpile.js:159:20

在新的承诺 ()

在 transpileWorker (/home/sevenbits/sevenbits-git/androidapplications/IonicBlockchainApp/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)

在 Object.transpile (/home/sevenbits/sevenbits-git/androidapplications/IonicBlockchainApp/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)

在/home/sevenbits/sevenbits-git/androidapplications/IonicBlockchainApp/node_modules/@ionic/app-scripts/dist/build.js:109:82

at <anonymous>
Run Code Online (Sandbox Code Playgroud)

我实在不知道错误从何而来。我该如何修复它?

node.js cordova ionic-framework

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

如何减小包含输入的离子项的宽度

我想减小项目/输入的宽度。但我不知道该怎么做!

这是代码。

<form #loginForm="ngForm" autocomplete="off">
    <ion-item color="calm" class="fields rounded-corners">
        <ion-icon name="person" item-left color="light"></ion-icon>
        <ion-input placeholder="Email" name="username" id="loginField" type="text" [(ngModel)]="username" #email>
        </ion-input>
    </ion-item>

    <ion-item color="calm" class="fields rounded-corners">
        <ion-icon name="lock" item-left color="light"></ion-icon>
        <ion-input placeholder="Password" name="password" id="passwordField" type="password" [(ngModel)]="password">
        </ion-input>
    </ion-item>

    <ion-row>
        <ion-col text-center>
            <div *ngIf="error" class="alert alert-danger">{{error}}</div>
                <button ion-button class="submit-btn rounded-corners" text-center text-Capitalize type="submit">Login
                </button>
        </ion-col>
    </ion-row>
</form>
Run Code Online (Sandbox Code Playgroud)

和CSS:

.fields{
   margin-top: 15px;
   margin-bottom: 15px;
   //  margin-left: 15px;
  //  margin-right: 15px;
 }
Run Code Online (Sandbox Code Playgroud)

我也尝试过使用左右边距,但似乎右边距不适用。请帮助我,因为我是 ionic 和 Html/css 的新手。

编辑

如图所示,电子邮件和密码输入具有全屏宽度。我想减少电子邮件和密码输入的宽度。

在此输入图像描述

html css ionic3

4
推荐指数
1
解决办法
1万
查看次数

如何设置饼图的标签颜色?

我正在使用mpandroidchart库来创建饼图。

我想格式化饼图上的文本标签,但我不知道该怎么做。我试过用

data.setValueTextColor(ContextCompat.getColor(getActivity(),R.color.black));
Run Code Online (Sandbox Code Playgroud)

但是,它只更改数据的值,而不是标签。另外,我想成为饼图中的标签,我也尝试过使用以下代码,

PieEntry entry2=new PieEntry(50-scratches,"Remaining \nScratches");
Run Code Online (Sandbox Code Playgroud)

但是,它没有用。

我的代码如下:

private void setPiechart(float scratches) {

    List<PieEntry> values = new ArrayList<>();

    PieEntry entry1=new PieEntry(scratches,"Scratches");
    PieEntry entry2=new PieEntry(50-scratches,"Remaining \nScratches");

    values.add(entry1);
    values.add(entry2);

    PieDataSet dataSet = new PieDataSet(values,"");

    dataSet.setColors(ContextCompat.getColor(getActivity(),R.color.color_veridoc_gradient1),
            ContextCompat.getColor(getActivity(),R.color.colorBgChat));

    dataSet.setHighlightEnabled(true);
    dataSet.setAutomaticallyDisableSliceSpacing(true);

    dataSet.setSliceSpace(10);

    PieData data=new PieData(dataSet);
    data.setValueTextSize(20f);
    data.setValueTextColor(ContextCompat.getColor(getActivity(),R.color.black));


    pieChart.setData(data);
    Description description=new Description();
    description.setText("Scratches ");
    pieChart.setDescription(description);
    pieChart.setDrawHoleEnabled(true);
    pieChart.setHoleRadius(10f);

    pieChart.animateY(500);

    Legend legend = pieChart.getLegend();
    legend.setEnabled(true);

    legend.setTextColor(Color.BLACK);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        pieChart.setElevation(10);
    }

}
Run Code Online (Sandbox Code Playgroud)

我得到的结果是: 在此处输入图片说明

我想做的是简而言之

  1. 更改饼图中的标签颜色(从白色到黑色)
  2. 防止标签超出饼图。(例如,如图所示的剩余划痕)

有人可以帮我吗?

我还尝试了以下链接中提到的这些解决方案。

链接 1 链接 2 …

android mpandroidchart

2
推荐指数
1
解决办法
5622
查看次数

ionic:在哪里查看显示的控制台日志

我是离子的新手我正在遵循离子框架文件来学习它.

这是我方法的代码:hello-ionic.ts

  openActionSheet(){
    let actionSheet=this.actionsheetCtrl.create(
    {
        title: 'Modify your album',
        cssClass: 'page-hello-ionic',
        buttons:[
          {
            text: 'Delete',
            role: 'destructive', //will always sort to be on top
            icon: !this.platform.is('ios') ? 'trash' : null,
            handler: () => {
              console.log('Delete clicked');
            }
          },
          {
          text: 'Play',
          icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
          handler: () => {
            console.log('Play clicked');
          }   
        },
        {
          text: 'Favorite',
          icon: !this.platform.is('ios') ? 'heart-outline' : null,
          handler: () => {
            console.log('Favorite clicked');
          }
        },
        {
          text: 'Cancel',
          role: …
Run Code Online (Sandbox Code Playgroud)

console.log ionic-framework

1
推荐指数
3
解决办法
2万
查看次数