我想更改项目的包名,所以我更改了build.gradle
和Android.xml
中的applicationid
。我使用下面的指南https://medium.com/@skyblazar.cc/how-to-change-the-package-name-of-your-flutter-app-4529e6e6e6fc更改了包名
Firebase数据库与我的项目链接,所以我想我也必须更改Firebase中的包名。因此,我在Firebase中添加了新的应用程序,更新了项目的包名,并根据需要添加了SHA密钥。做完所有这些之后,我开始测试我的应用程序。除了电话认证,一切都很好。谷歌认证运行良好。
I/flutter (15570): New user result at the end before await: null
E/zzf (15570): Problem retrieving SafetyNet Token: 7:
W/ActivityThread(15570): handleWindowVisibility: no activity for token android.os.BinderProxy@7518a38
D/ViewRootImpl@9a0d0b4[MainActivity](15570): MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager(15570): prepareNavigationBarInfo() DecorView@b62e3fa[MainActivity]
D/InputMethodManager(15570): getNavigationBarColor() -855310
I/DecorView(15570): createDecorCaptionView >> DecorView@1ec25a[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
W/System (15570): Ignoring header X-Firebase-Locale because its value was null.
I/System.out(15570): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(15570): (HTTPLog)-Static: isSBSettingEnabled false
D/InputTransport(15570): Input channel constructed: fd=97
D/ViewRootImpl@141d474[RecaptchaActivity](15570): setView = DecorView@1ec25a[RecaptchaActivity] TM=true MM=false
D/ViewRootImpl@141d474[RecaptchaActivity](15570): dispatchAttachedToWindow
D/ViewRootImpl@141d474[RecaptchaActivity](15570): Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x7 surface={valid=true 545211748352} changed=true
D/OpenGLRenderer(15570): eglCreateWindowSurface = 0x7efbe16f80, 0x7ef1271010
D/ViewRootImpl@141d474[RecaptchaActivity](15570): MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 0) vi=Rect(0, 63 - 0, 0) or=1
D/InputTransport(15570): Input channel destroyed: fd=132
D/AndroidRuntime(15570): Shutting down VM
E/AndroidRuntime(15570): FATAL EXCEPTION: main
E/AndroidRuntime(15570): Process: com.xxxxx.xxxxx, PID: 15570
E/AndroidRuntime(15570): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
E/AndroidRuntime(15570): at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.1:13)
E/AndroidRuntime(15570): at com.google.android.gms.internal.firebase-auth-api.zzth.zzb(com.google.firebase:firebase-auth@@20.0.1:7)
E/AndroidRuntime(15570): at com.google.android.gms.internal.firebase-auth-api.zzth.onPostExecute(Unknown Source:2)
E/AndroidRuntime(15570): at android.os.AsyncTask.finish(AsyncTask.java:695)
E/AndroidRuntime(15570): at android.os.AsyncTask.access$600(AsyncTask.java:180)
E/AndroidRuntime(15570): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
E/AndroidRuntime(15570): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(15570): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(15570): at android.app.ActivityThread.main(ActivityThread.java:7073)
E/AndroidRuntime(15570): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15570): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/AndroidRuntime(15570): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
E/AndroidRuntime(15570): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/com.storeifie.storeify-DOxHXgyJA9JAe6BK8YeeWA==/base.apk"],nativeLibraryDirectories=[/data/app/com.storeifie.storeify-DOxHXgyJA9JAe6BK8YeeWA==/lib/arm64, /data/app/com.storeifie.storeify-DOxHXgyJA9JAe6BK8YeeWA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
E/AndroidRuntime(15570): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(15570): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(15570): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(15570): ... 12 more
I/Process (15570): Sending signal. PID: 15570 SIG: 9
Lost connection to device.
Exited (sigterm)
在下面的代码片段等待FirebaseAuth.instance.verifyPhoneNumber
从未运行。verificationcomplete
和smscodesent
从未执行。我在想为什么?在更改包名之前,它工作得很好
Future<dynamic> verifyPhone(phoneNo, BuildContext context) async {
var completer = Completer<dynamic>();
dynamic newUserResult;
Future<String> getOTPresult() async {
print("Dialog shown");
await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) => Container(
height: 270,
child: OTPBottomSheet(controller: _otpController),
),
);
return _otpController.text;
}
// >>>>>>>>>>>>> On Complete
final PhoneVerificationCompleted verificationComplete =
(AuthCredential authCred) async {
print(" I N S I D E C O M P L E T E ");
newUserResult = await signInWithPhoneNumber(authCred);
completer.complete(newUserResult);
};
// >>>>>>>>>>>>> On Timeout
final PhoneCodeAutoRetrievalTimeout autoRetrieve = (String verID) {
print("\n2. Auto retrieval time out");
completer.complete(newUserResult);
};
// >>>>>>>>>>>>> On manual code verification
final PhoneCodeSent smsCodeSent =
(String verID, [int forceCodeResend]) async {
print(" I N S I D E C O D E S E N T");
var OTPDialogResult = await getOTPresult();
if (OTPDialogResult != null) {
AuthCredential authCred = PhoneAuthProvider.credential(
verificationId: verID, smsCode: OTPDialogResult);
newUserResult = AuthService().signInWithPhoneNumber(authCred);
if (!completer.isCompleted) {
completer.complete(newUserResult);
}
}
};
// >>>>>>>>>>>>> On Ver failed
final PhoneVerificationFailed verificationFailed =
(Exception authException) {
completer.complete(newUserResult);
};
await FirebaseAuth.instance
.verifyPhoneNumber(
phoneNumber: phoneNo,
timeout: Duration(seconds: 50),
verificationCompleted: verificationComplete,
verificationFailed: verificationFailed,
codeSent: smsCodeSent,
codeAutoRetrievalTimeout: autoRetrieve,
).catchError((error) {
print(error.toString());
});
print("New user result at the end before await: " + newUserResult.toString());
newUserResult = await completer.future;
print("New user result at the end after await: " + newUserResult.toString());
return newUserResult;
}
SigninWithPhoneNumber
函数
Future signInWithPhoneNumber(AuthCredential authCreds) async {
try {
UserCredential result = await FirebaseAuth.instance.signInWithCredential(authCreds);
User customUser = result.user;
return _userFormFirebaseUser(customUser).getuid;
}
CustData _userFormFirebaseUser(User user) {
print("----> Inside _userFormFirebaseUser and user ID: " + user.uid);
return user != null
? CustData(
custId: user.uid,
)
: null;
}
// --- CustData model class
class CustData {
String custId;
String custName;
String custPhNo;
String custContactNO;
DateTime custDateOfBirth;
Map<String, dynamic> address;
String cartID;
CustData({
this.custId,
this.custName,
this.custPhNo,
this.custDateOfBirth,
this.address,
this.cartID,
this.custContactNO,
});
CustData.initial() : custId = '';
String get getuid => this.custId;
}
我通过简单地将flower line添加到app/build.gradle依赖项中来解决这个问题。
implementation "androidx.browser:browser:1.2.0"
我想更改android应用程序的程序包名称。我想手动编辑源代码的所有文件。这能行吗?或者无论如何,我必须使用Android studio?
我想知道,在谷歌Play上更改Android应用程序的实际软件包名称在技术上是否可行,而不是简单与否。我所说的包名是将显示在URL中的名称。请问,谁能告诉我为什么这是/不可能的?谢谢
我试着从中进行更改,但它得到了更改,但Flutter提供了一种方法来实现这一点吗?
我刚刚完成了我的第一个android应用程序,并生成了一个apk文件在我的手机上测试。然后我意识到我在制作项目时留下了默认的“My Application”名称。所以安装的应用程序名为“我的应用程序”。如何更改应用程序的名称?
我想用SafetyNet验证电话号码Firebase,而不是重新CAPTCHA验证。我在这里遵循Firebase留档:https://firebase.google.com/docs/auth/android/phone-auth 在谷歌API控制台中,我启用了Android设备验证API 在Firebase控制台中,我添加了SHA-256指纹 重新安装谷歌服务。json并将其添加到项目中 它总是
我需要编译同一个应用程序的两个副本,有一个唯一的包名(这样我就可以向市场发布两次)。