我的应用发布版本上的错误和崩溃

如何解决我的应用发布版本上的错误和崩溃

我的应用发行版存在很大的问题。 (https://play.google.com/store/apps/details?id=com.conta.ftof 请尝试下载它以帮助我) 在调试版本中,一切正常,但在发布版本中,只要我通过电话号码对Firebase进行身份验证或仅进行身份验证,然后单击“回收者视图”按钮,应用程序就会崩溃...我最近添加了sha键-1和sha-256到firebase项目,我添加了新的json文件,因为身份验证不起作用,现在身份验证可以正常工作,但是正如我已经说过的,只要您通过身份验证,该应用程序就会崩溃。我不知道是不是Google广告的问题,这是我在1星期前在contactsactivity中添加的。奇怪的是调试版本可以正常运行...我留给您代码了...

enter image description here

暗恋的LogCat

EndProcessProperty

ContactsActivity:

 --------- beginning of crash
2020-10-16 19:11:58.221 22176-22176/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.conta.ftof,PID: 22176
    c.e.c.m.d: No properties to serialize found on class c.b.a.d
        at c.e.c.m.x.z0.o.a$a.<init>(:11)
        at c.e.c.m.x.z0.o.a.e(Unknown Source:12)
        at c.e.c.m.x.z0.o.a.b(:4)
        at c.c.a.b.b.a(:5)
        at c.c.a.a.a.a(:3)
        at com.firebase.ui.database.FirebaseRecyclerAdapter.p(:2)
        at androidx.recyclerview.widget.RecyclerView$g.q(Unknown Source:0)
        at androidx.recyclerview.widget.RecyclerView$v.k(:80)
        at androidx.recyclerview.widget.LinearLayoutManager$c.c(:3)
        at androidx.recyclerview.widget.LinearLayoutManager.t1(Unknown Source:0)
        at androidx.recyclerview.widget.LinearLayoutManager.e1(:2)
        at androidx.recyclerview.widget.LinearLayoutManager.s0(:22)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(Unknown Source:38)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayout(Unknown Source:37)
        at androidx.recyclerview.widget.RecyclerView.onLayout(Unknown Source:5)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1842)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1686)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1595)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1842)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1686)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1595)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at com.android.internal.policy.DecorView.onLayout(DecorView.java:902)
        at android.view.View.layout(View.java:20948)
        at android.view.ViewGroup.layout(ViewGroup.java:6279)
        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3037)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2545)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1636)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7946)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092)
        at android.view.Choreographer.doCallbacks(Choreographer.java:893)
        at android.view.Choreographer.doFrame(Choreographer.java:812)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078)
        at android.os.Handler.handleCallback(Handler.java:907)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
2020-10-16 19:11:58.227 1272-2391/? E/ActivityManager: The same pid with last one,do not add dropbox and clear mLastCrashedPid. mLastAppCrashedPid==22176

构建gradle:app

//[...import some libraries...]
        public class ContactsActivity extends AppCompatActivity {
    BottomNavigationView navView;
    RecyclerView myContactsList;
    ImageView findPeopleBtn;
    
        private DatabaseReference contactsRef,usersRef;
        private FirebaseAuth mAuth;
        private String currentUserId;
    
        private String userName = "",profileImage="";
        private String calledBy = "";
        private AdView mAdView;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_contacts);
            //ads
            MobileAds.initialize(this,new OnInitializationCompleteListener() {
                @Override
                public void onInitializationComplete(InitializationStatus initializationStatus) {
    
                }
            });
            //ads
            AdView adView = new AdView(this);
    
            adView.setAdSize(AdSize.BANNER);
            adView.setAdUnitId("ca-app-pub-3400243939195187/7974459299");
            mAdView = findViewById(R.id.adView);
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest);
    
            mAuth = FirebaseAuth.getInstance();
            currentUserId = mAuth.getCurrentUser().getUid();
            contactsRef = FirebaseDatabase.getInstance().getReference().child("Contacts");
            usersRef = FirebaseDatabase.getInstance().getReference().child("Users");
    
    
            navView = findViewById(R.id.nav_view);
            navView.setOnNavigationItemSelectedListener(navigationItemSelectedListener);
    
            findPeopleBtn = findViewById(R.id.find_people_btn);
            myContactsList = findViewById(R.id.contact_list);
            myContactsList.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
    
            findPeopleBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
    
                    Intent findpeopleIntent = new Intent(ContactsActivity.this,FindPeopleActivity.class);
                    startActivity(findpeopleIntent);
    
                }
            });
    
    
    
    
        }
    
        private BottomNavigationView.OnNavigationItemSelectedListener navigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
    
                switch (menuItem.getItemId()){
    
                    case R.id.navigation_home:
                        Intent mainIntent = new Intent(ContactsActivity.this,ContactsActivity.class);
                        startActivity(mainIntent);
                        break;
    
                    case R.id.navigation_settings:
                        Intent settingsIntent = new Intent(ContactsActivity.this,SettingsActivity.class);
                        startActivity(settingsIntent);
                        break;
    
                    case R.id.navigation_notifications:
                        Intent notificationsIntent = new Intent(ContactsActivity.this,NotificationsActivity.class);
                        startActivity(notificationsIntent);
                        break;
    
                    case R.id.navigation_logout:
                        FirebaseAuth.getInstance().signOut();
                        Intent logoutIntent = new Intent(ContactsActivity.this,RegistrationActivity.class);
                        startActivity(logoutIntent);
                        finish();
                        break;
    
                    case R.id.navigation_donate:
                        Intent donateIntent = new Intent(ContactsActivity.this,donate.class);
                        startActivity(donateIntent);
                        finish();
                        break;
                }
    
                return true;
            }
        };
    
    
        @Override
        protected void onStart() {
            super.onStart();
    
            checkForReceivingCall();
    
            validateUser();
    
            FirebaseRecyclerOptions<Contacts> options
                    = new FirebaseRecyclerOptions.Builder<Contacts>()
                    .setQuery(contactsRef.child(currentUserId),Contacts.class)
                    .build();
    
            FirebaseRecyclerAdapter<Contacts,ContactsViewHolder> firebaseRecyclerAdapter
    
                    =new FirebaseRecyclerAdapter<Contacts,ContactsViewHolder>(options) {
                @Override
                protected void onBindViewHolder(@NonNull final ContactsViewHolder holder,int i,@NonNull Contacts contacts) {
    
    
                    final String listUserId = getRef(i).getKey();
    
                    usersRef.child(listUserId).addValueEventListener(new ValueEventListener() {
                        @Override
                        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
    
                            if(dataSnapshot.exists()){
    
    
                                userName = dataSnapshot.child("name").getValue().toString();
                                profileImage = dataSnapshot.child("image").getValue().toString();
    
                                holder.userNameTxt.setText(userName);
                                Picasso.get().load(profileImage).into(holder.profileImageView);
    
                                holder.callBtn.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
    
    
                                        Intent callingIntent = new Intent(ContactsActivity.this,CallingActivity.class);
                                        callingIntent.putExtra("visit_user_id",listUserId);
                                        startActivity(callingIntent);
    
    
                                    }
                                });
    
                            }
    
                        }
    
                        @Override
                        public void onCancelled(@NonNull DatabaseError databaseError) {
    
                        }
                    });
    
                }
    
                @NonNull
                @Override
                public ContactsViewHolder onCreateViewHolder(@NonNull ViewGroup parent,int viewType) {
    
                    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.contact_design,parent,false);
    
                    ContactsViewHolder viewHolder = new ContactsViewHolder(view);
                    return viewHolder;
    
                }
            };
    
            myContactsList.setAdapter(firebaseRecyclerAdapter);
            firebaseRecyclerAdapter.startListening();
        }
    
    
    
    
        public static class ContactsViewHolder extends RecyclerView.ViewHolder{
    
            TextView userNameTxt;
            Button callBtn;
            ImageView profileImageView;
    
    
    
            public ContactsViewHolder(@NonNull View itemView) {
                super(itemView);
    
                userNameTxt = itemView.findViewById(R.id.name_contact);
                callBtn = itemView.findViewById(R.id.call_btn);
                profileImageView = itemView.findViewById(R.id.image_contact);
    
            }
        }
    
        private void validateUser() {
    
            DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
    
            reference.child("Users").child(currentUserId).addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
    
    
    
                }
    
                @Override
                public void onCancelled(@NonNull DatabaseError databaseError) {
    
                    Intent settingIntent = new Intent(ContactsActivity.this,SettingsActivity.class);
                    startActivity(settingIntent);
                    finish();
    
                }
            });
        }
    
    
        private void checkForReceivingCall() {
    
            usersRef.child(currentUserId)
                    .child("Ringing")
                    .addValueEventListener(new ValueEventListener() {
                        @Override
                        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
    
                            if (dataSnapshot.hasChild("ringing")){
    
                                calledBy = dataSnapshot.child("ringing").getValue().toString();
    
                                Intent callingIntent = new Intent(ContactsActivity.this,CallingActivity.class);
                                callingIntent.putExtra("visit_user_id",calledBy);
                                startActivity(callingIntent);
    
    
                            }
    
                        }
    
                        @Override
                        public void onCancelled(@NonNull DatabaseError databaseError) {
    
                        }
                    });
    
        }
    
    }

构建gradle项目

    apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    lintOptions {
        checkReleaseBuilds false
        // Or,if you prefer,you can continue to check for errors in release builds,// but continue the build even when errors are found:
        abortOnError false
    }

    defaultConfig {
        applicationId "com.conta.ftof"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 3
        versionName "1.2"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs",include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.firebaseui:firebase-ui-database:3.2.2'
    implementation 'com.hbb20:ccp:2.1.9'
    implementation 'pub.devrel:easypermissions:0.4.0'
    implementation 'com.android.support:percent:29.0.0'
    implementation 'com.google.android.gms:play-services-ads:19.4.0'


    implementation 'com.google.firebase:firebase-storage:19.1.1'
    implementation 'com.google.android.material:material: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.opentok.android:opentok-android-sdk:2.15.3'
    implementation 'pub.devrel:easypermissions:0.4.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.2.0'
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

}

通话活动

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath 'com.google.gms:google-services:4.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

        maven { url 'https://maven.google.com'}
        maven { url 'https://tokbox.bintray.com/maven'}
    }
}

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

解决方法

如果您是初学者,那么我建议您在build.gradle中禁用minifyEnabled。基本上proguard会混淆代码,并且您可能不会在proguard规则中转义模型文件

android {
    ...

    buildTypes {
        release {
            minifyEnabled false // disable proguard
            ...
        }
    }
}

[UPDATE]:这是您可以在progaurd中转义文件的方式

在您的proguard-android-optimize.txt文件中执行以下操作

如果所有模型都在同一文件夹中,则:

-keep public class com.myapp.models.** {
  public protected private *;
}

否则,您可以使用以下方式跳过文件:

-keep public class com.myapp.models.MyModel {
  public protected private *;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)&gt; insert overwrite table dwd_trade_cart_add_inc &gt; select data.id, &gt; data.user_id, &gt; data.course_id, &gt; date_format(
错误1 hive (edu)&gt; insert into huanhuan values(1,&#39;haoge&#39;); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive&gt; show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 &lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.res