question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

io.grpc.StatusRuntimeException: INTERNAL: No value received for unary call

See original GitHub issue

io.grpc.StatusRuntimeException: INTERNAL: No value received for unary call I’m getting this Exception message from my grpc unary call while running my signed apk . I get this RunTime Exception Only when I Get a Release Version and not on debug mode please help me out I’m really getting frustrated:

here is my build.gradle (module):

apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
//TODO KOTLIN

android {
    compileSdkVersion 29
    buildToolsVersion "30.0.3"
    defaultConfig {
        
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 97
        versionName "2.2.6.7"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        sourceSets {
            main {
                proto {
                    srcDir 'src/main/protos'
                }
            }
        }
    }
    buildTypes {
        debug {
           // useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

        }

            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
                lintOptions {
                    abortOnError false
                    disable 'MissingTranslation'
                }
            }

    }
    dataBinding {
        //noinspection DataBindingWithoutKapt
        enabled = true;
    }
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }

    compileOptions {

        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


}

protobuf {
    protoc { artifact = 'com.google.protobuf:protoc:4.0.0-rc-2' }
    plugins {

        grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.43.1'
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java { option 'lite' }
            }
            task.plugins {
                grpc {
                    option 'lite'
                }
            }
        }
    }
}

dependencies {


 


  

    // ramotion , animation open cell
    implementation 'com.ramotion.foldingcell:folding-cell:1.2.3'

    // time piker persian
    implementation 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'

    // shine button animation
    implementation 'com.sackcentury:shinebutton:1.0.0'

    // navigation tab bar
    implementation 'devlight.io:navigationtabbar:1.2.5'

    // swipe layout
    implementation 'com.daimajia.swipelayout:library:1.2.0'

    // fab
    implementation 'com.github.clans:fab:1.6.4'

    // search bar
    implementation 'com.miguelcatalan:materialsearchview:1.4.0'

    // guid for app
    implementation 'uk.co.samuelwall:material-tap-target-prompt:2.14.0'

    // chart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    // Sliding Up Panel
    implementation 'com.sothree.slidinguppanel:library:3.4.0'

    // barcode scanner
    implementation 'me.dm7.barcodescanner:zxing:1.9.13'

    // lib in app
    implementation(name: 'RootTools', ext: 'aar')
    implementation(name: 'RootShell', ext: 'aar')
    implementation files('libs/achartengine-1.2.0.jar')
    implementation files('libs/bixolon_printer_V132.jar')
    implementation files('libs/jpos121-controls.jar')
    implementation files('libs/xerces.jar')
    implementation files('libs/urovo_sdk_v2.3.706.jar')
    implementation 'androidx.ads:ads-identifier:1.0.0-alpha04'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'



    //problem in permissions
    implementation 'androidx.preference:preference:1.1.1'

    //Picasso
    implementation 'com.squareup.picasso:picasso:2.71828'


    //Glide

    implementation("com.github.bumptech.glide:glide:4.9.0") {
        exclude group: 'androidx.vectordrawable', module: 'vectordrawable-animated'
    }










    //rxjava2_retrofit
    implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

    //rxjava_rxandroid
    implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'


    //rxLifeCycle
    implementation 'com.uber.autodispose:autodispose:1.1.0'
    implementation 'com.uber.autodispose:autodispose-android-archcomponents:1.1.0'



    implementation 'com.github.afshin1394:central_exception_handler:1.0.5'



    //Grpc
    implementation 'io.grpc:grpc-okhttp:1.43.1'
    implementation 'io.grpc:grpc-protobuf-lite:1.43.1'
    implementation 'io.grpc:grpc-stub:1.43.1'
    compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+




}

and my build.gradle(project):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com' }
        flatDir {
            dirs 'libs'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.4'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
//        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com' }
        flatDir {
            dirs 'libs'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

here is one of my protobuf files:

syntax = "proto3";

option java_package = "com.saphamrah";
option java_outer_classname = "AccountTypeProto";

package Amargar;

service AccountType{
  rpc GetAccountType(AccountTypeRequest) returns(AccountTypeReplyList);
}

message AccountTypeRequest{

}

message AccountTypeReply{
  int32	AccountTypeID = 1;
  string	AccountTypeName = 2;
}

message AccountTypeReplyList{
  repeated AccountTypeReply AccountTypeReplys = 1;
}

and this is how I create my unary calls:

    {
        try {
            ServerIpModel serverIpModel = new PubFunc().new NetworkUtils().getServerFromShared(context);
      
            serverIpModel.setPort("5000");

            if (serverIpModel.getServerIp().trim().equals("") || serverIpModel.getPort().trim().equals("")) {
                String message = "can't find server";
                PubFunc.Logger logger = new PubFunc().new Logger();
                logger.insertLogToDB(context, Constants.LOG_EXCEPTION(), message, NoeHesabDAO.class.getSimpleName(), activityNameForLog, "fetchNoeHesabGrpc", "");
                retrofitResponse.onFailed(Constants.HTTP_EXCEPTION(), message);
            } else {

                CompositeDisposable compositeDisposable = new CompositeDisposable();
                ManagedChannel managedChannel = GrpcChannel.channel(serverIpModel);
                AccountTypeGrpc.AccountTypeBlockingStub accountTypeBlockingStub = AccountTypeGrpc.newBlockingStub(managedChannel);
                AccountTypeProto.AccountTypeRequest accountTypeRequest = AccountTypeProto.AccountTypeRequest.newBuilder().build();
                Callable<AccountTypeProto.AccountTypeReplyList> accountTypeReplyListCallable = () -> accountTypeBlockingStub.getAccountType(accountTypeRequest);
                RxAsync.makeObservable(accountTypeReplyListCallable)
                        .map(accountTypeReplyList ->  {
                            ArrayList<NoeHesabModel> models = new ArrayList<>();
                            for (AccountTypeProto.AccountTypeReply reply : accountTypeReplyList.getAccountTypeReplysList()) {
                                NoeHesabModel model = new NoeHesabModel();

                                model.setCcNoeHesab(reply.getAccountTypeID());
                                model.setNameNoeHesab(reply.getAccountTypeName());

                            }
                            return models;
                        })
                        .subscribeOn(Schedulers.io())
                        .observeOn(AndroidSchedulers.mainThread())
                        .subscribe(new Observer<ArrayList<NoeHesabModel>>() {
                            @Override
                            public void onSubscribe(@NonNull Disposable d) {
                                compositeDisposable.add(d);
                            }

                            @Override
                            public void onNext(@NonNull ArrayList<NoeHesabModel> noeHesabModels) {
                                response.onSuccess(noeHesabModels);
                            }

                            @Override
                            public void onError(@NonNull Throwable e) {
                                response.onFailed(Constants.HTTP_EXCEPTION(), e.getMessage());
                            }

                            @Override
                            public void onComplete() {
                                if (!compositeDisposable.isDisposed()) {
                                    compositeDisposable.dispose();
                                }
                                compositeDisposable.clear();
                            }
                        });

            }
        }catch (Exception exception){
            PubFunc.Logger logger = new PubFunc().new Logger();
            logger.insertLogToDB(context, Constants.LOG_EXCEPTION(), exception.getMessage(), NoeHesabDAO.class.getSimpleName(), activityNameForLog, "fetchNoeHesabGrpc", "");
            retrofitResponse.onFailed(Constants.HTTP_EXCEPTION(), exception.getMessage());
        }
    }

thanks for your help

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dapengzhang0commented, Jan 12, 2022
protoc { artifact = 'com.google.protobuf:protoc:4.0.0-rc-2' }
   plugins {
       grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.43.1'
       }
   }

@afshin1394 Why are you using protoc 4.0.0-rc-2 with protoc-gen-grpc-java:1.43.1? The major version of protoc 4 seems too high, and it is not tested/compatible with protoc-gen-grpc-java:1.43.1. Can you test with protoc:3.19.2 that is officially supported by protoc-gen-grpc-java:1.43.1?

1reaction
sanjaypujarecommented, Jan 4, 2022

… I’m getting the response in my android app on debug version. But when I get the signed release version of my app it’s giving me this runtime exception.its really annoying .

That’s strange. Is it possible to collect logs and stack trace on the client side?

Read more comments on GitHub >

github_iconTop Results From Across the Web

io.grpc.StatusRuntimeException: INTERNAL: No value ...
It received an OK status code (which means the RPC is complete), but no actual response message. There's likely a bug on the...
Read more >
java - gRpc, client getting io.grpc.StatusRuntimeException ...
Everything compiles and starts up just fine, when the client makes a call to the server, the server receives the call and prints...
Read more >
gRPC-Java: How to catch StatusRuntimeException on Server ...
We had an issue today where gRPC server received a corrupted protobuf message. ... io.grpc.StatusRuntimeException: INTERNAL: Invalid protobuf byte sequence
Read more >
grpc/grpc - Gitter
I am transitioning a sync grpc client to an async grpc client with the c++ callback API. Normally the async Unary RPCs work,...
Read more >
Index (grpc-all 1.26.0 API) - javadoc.io
Creates a ServerCallHandler for a unary call method of the service. ... Deprecated. Returns a ListenableFuture for the first value received from the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found