Help me to solve the error log in here
Have a look at the log.
The logs are very good at showing what is wrong. If you dont understand then please paste it here
Buildfile: /home/Makeroid/appinventor/build.xml
extensions:
clean:
init:
[mkdir] Created dir: /home/Makeroid/appinventor/build/buildserver
[mkdir] Created dir: /home/Makeroid/appinventor/buildserver/build
[mkdir] Created dir: /home/Makeroid/appinventor/buildserver/build/classes
[mkdir] Created dir: /home/Makeroid/appinventor/buildserver/reports
[mkdir] Created dir: /home/Makeroid/appinventor/buildserver/reports/raw
[mkdir] Created dir: /home/Makeroid/appinventor/buildserver/reports/html
common_CommonUtils:
init:
[mkdir] Created dir: /home/Makeroid/appinventor/build/common
[mkdir] Created dir: /home/Makeroid/appinventor/common/build
[mkdir] Created dir: /home/Makeroid/appinventor/common/build/classes
[mkdir] Created dir: /home/Makeroid/appinventor/common/reports
[mkdir] Created dir: /home/Makeroid/appinventor/common/reports/raw
[mkdir] Created dir: /home/Makeroid/appinventor/common/reports/html
CommonUtils:
[mkdir] Created dir: /home/Makeroid/appinventor/common/build/classes/CommonUtils
[javac] Compiling 3 source files to /home/Makeroid/appinventor/common/build/classes/CommonUtils
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
[javac] Creating empty /home/Makeroid/appinventor/common/build/classes/CommonUtils/com/google/appinventor/common/utils/package-info.class
[jar] Building jar: /home/Makeroid/appinventor/build/common/CommonUtils.jar
[jar] Building jar: /home/Makeroid/appinventor/build/common/CommonUtils-gwt.jar
common_CommonVersion:
init:
CommonVersion:
[mkdir] Created dir: /home/Makeroid/appinventor/common/build/classes/CommonVersion
[mkdir] Created dir: /home/Makeroid/appinventor/common/build/src/com/google/appinventor/common/version
[copy] Copying 1 file to /home/Makeroid/appinventor/common/build/src/com/google/appinventor/common/version
[javac] Compiling 3 source files to /home/Makeroid/appinventor/common/build/classes/CommonVersion
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
[javac] Creating empty /home/Makeroid/appinventor/common/build/classes/CommonVersion/com/google/appinventor/common/version/package-info.class
[jar] Building jar: /home/Makeroid/appinventor/build/common/CommonVersion.jar
[jar] Building jar: /home/Makeroid/appinventor/build/common/CommonVersion-gwt.jar
CopyToRunLibDir:
[mkdir] Created dir: /home/Makeroid/appinventor/buildserver/build/run/lib
[copy] Copying 36 files to /home/Makeroid/appinventor/buildserver/build/run/lib
components_AndroidRuntime:
init:
[mkdir] Created dir: /home/Makeroid/appinventor/build/components
[mkdir] Created dir: /home/Makeroid/appinventor/components/build
[mkdir] Created dir: /home/Makeroid/appinventor/components/build/classes
[mkdir] Created dir: /home/Makeroid/appinventor/components/reports
[mkdir] Created dir: /home/Makeroid/appinventor/components/reports/raw
[mkdir] Created dir: /home/Makeroid/appinventor/components/reports/html
CommonConstants:
[mkdir] Created dir: /home/Makeroid/appinventor/components/build/classes/CommonConstants
[javac] Compiling 7 source files to /home/Makeroid/appinventor/components/build/classes/CommonConstants
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
[javac] Creating empty /home/Makeroid/appinventor/components/build/classes/CommonConstants/com/google/appinventor/components/common/package-info.class
[jar] Building jar: /home/Makeroid/appinventor/build/components/CommonConstants.jar
[jar] Building jar: /home/Makeroid/appinventor/build/components/CommonConstants-gwt.jar
HtmlEntities:
[mkdir] Created dir: /home/Makeroid/appinventor/components/build/classes/HtmlEntities
[javac] Compiling 1 source file to /home/Makeroid/appinventor/components/build/classes/HtmlEntities
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
[jar] Building jar: /home/Makeroid/appinventor/components/build/HtmlEntities.jar
common_CommonVersion:
init:
CommonVersion:
AndroidRuntime:
[mkdir] Created dir: /home/Makeroid/appinventor/components/build/classes/AndroidRuntime
[javac] Compiling 362 source files to /home/Makeroid/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /home/Makeroid/appinventor/components/src/com/google/appinventor/components/runtime/PhoneAuth.java:25: error: ‘{’ expected
[javac] public final class NewExtension extends AndroidNonvisibleComponent
[javac] ^
[javac] /home/Makeroid/appinventor/components/src/com/google/appinventor/components/runtime/PhoneAuth.java:264: error: reached end of file while parsing
[javac] }
[javac] ^
[javac] 2 errors
[javac] 1 warning
Just a syntax error You are missing a {
package io.makeroid.suryaprakashlokula.PhoneAuth;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
@DesignerComponent(
version = 1,
description = “Access the firebase Authentication”,
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = “https://ide.kodular.io/assets/logo.png”)
@SimpleObject(external = true)
public final class NewExtension extends AndroidNonvisibleComponent
public NewExtension(ComponentContainer container) {
super(container.$form());
}
public class FirebasePhoneNumAuthActivity extends AppCompatActivity {
private static String uniqueIdentifier = null;
private static final String UNIQUE_ID = “UNIQUE_ID”;
private static final long ONE_HOUR_MILLI = 60601000;
private static final String TAG = “FirebasePhoneNumAuth”;
private PhoneAuthProvider.OnVerificationStateChangedCallbacks callbacks;
private FirebaseAuth firebaseAuth;
private String phoneNumber;
private Button sendCodeButton;
private Button verifyCodeButton;
private Button signOutButton;
private EditText phoneNum;
private EditText verifyCodeET;
private FirebaseFirestore firestoreDB;
private FirebaseUser firebaseUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.firebase_phone_auth_layout);
sendCodeButton = findViewById(R.id.send_code_b);
verifyCodeButton = findViewById(R.id.verify_code_b);
signOutButton = findViewById(R.id.auth_logout_b);
phoneNum = findViewById(R.id.phone);
verifyCodeET = findViewById(R.id.phone_auth_code);
addOnClickListeners();
firebaseAuth = FirebaseAuth.getInstance();
firestoreDB = FirebaseFirestore.getInstance();
createCallback();
getInstallationIdentifier();
getVerificationDataFromFirestoreAndVerify(null);
}
private void addOnClickListeners() {
sendCodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
verifyPhoneNumberInit();
}
});
verifyCodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
verifyPhoneNumberCode();
}
});
signOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
signOut();
}
});
}
private void createCallback() {
callbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
Log.d(TAG, “verification completed” + credential);
signInWithPhoneAuthCredential(credential);
}
@Override
public void onVerificationFailed(FirebaseException e) {
Log.w(TAG, “verification failed”, e);
if (e instanceof FirebaseAuthInvalidCredentialsException) {
phoneNum.setError(“Invalid phone number.”);
} else if (e instanceof FirebaseTooManyRequestsException) {
Toast.makeText(FirebasePhoneNumAuthActivity.this,
“Trying too many timeS”,
Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCodeSent(String verificationId,
PhoneAuthProvider.ForceResendingToken token) {
Log.d(TAG, "code sent " + verificationId);
addVerificationDataToFirestore(phoneNumber, verificationId);
}
};
}
private boolean validatePhoneNumber(String phoneNumber) {
if (TextUtils.isEmpty(phoneNumber)) {
phoneNum.setError(“Invalid phone number.”);
return false;
}
return true;
}
private void verifyPhoneNumberInit() {
phoneNumber = phoneNum.getText().toString();
if (!validatePhoneNumber(phoneNumber)) {
return;
}
verifyPhoneNumber(phoneNumber);
}
private void verifyPhoneNumber(String phno){
PhoneAuthProvider.getInstance().verifyPhoneNumber(phno, 70,
TimeUnit.SECONDS, this, callbacks);
}
private void verifyPhoneNumberCode() {
final String phone_code = verifyCodeET.getText().toString();
getVerificationDataFromFirestoreAndVerify(phone_code);
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
firebaseAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Log.d(TAG, “code verified signIn successful”);
firebaseUser = task.getResult().getUser();
showSingInButtons();
} else {
Log.w(TAG, “code verification failed”, task.getException());
if (task.getException() instanceof
FirebaseAuthInvalidCredentialsException) {
verifyCodeET.setError(“Invalid code.”);
}
}
}
});
}
private void createCredentialSignIn(String verificationId, String verifyCode) {
PhoneAuthCredential credential = PhoneAuthProvider.
getCredential(verificationId, verifyCode);
signInWithPhoneAuthCredential(credential);
}
private void signOut() {
firebaseAuth.signOut();
showSendCodeButton();
}
private void addVerificationDataToFirestore(String phone, String verificationId) {
Map verifyMap = new HashMap();
verifyMap.put(“phone”, phone);
verifyMap.put(“verificationId”, verificationId);
verifyMap.put(“timestamp”,System.currentTimeMillis());
firestoreDB.collection(“phoneAuth”).document(uniqueIdentifier)
.set(verifyMap)
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(DocumentReference documentReference) {
Log.d(TAG, "phone auth info added to db ");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, “Error adding phone auth info”, e);
}
});
}
private void getVerificationDataFromFirestoreAndVerify(final String code) {
initButtons();
firestoreDB.collection(“phoneAuth”).document(uniqueIdentifier)
.get()
.addOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
DocumentSnapshot ds = task.getResult();
if(ds.exists()){
disableSendCodeButton(ds.getLong(“timestamp”));
if(code != null){
createCredentialSignIn(ds.getString(“verificationId”),
code);
}else{
verifyPhoneNumber(ds.getString(“phone”));
}
}else{
showSendCodeButton();
Log.d(TAG, “Code hasn’t been sent yet”);
}
} else {
Log.d(TAG, "Error getting document: ", task.getException());
}
}
});
}
public synchronized String getInstallationIdentifier() {
if (uniqueIdentifier == null) {
SharedPreferences sharedPrefs = this.getSharedPreferences(
UNIQUE_ID, Context.MODE_PRIVATE);
uniqueIdentifier = sharedPrefs.getString(UNIQUE_ID, null);
if (uniqueIdentifier == null) {
uniqueIdentifier = UUID.randomUUID().toString();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putString(UNIQUE_ID, uniqueIdentifier);
editor.commit();
}
}
return uniqueIdentifier;
}
private void disableSendCodeButton(long codeSentTimestamp){
long timeElapsed = System.currentTimeMillis()- codeSentTimestamp;
if(timeElapsed > ONE_HOUR_MILLI){
showSendCodeButton();
}else{
findViewById(R.id.phone_auth_items).setVisibility(View.GONE);
findViewById(R.id.phone_auth_code_items).setVisibility(View.VISIBLE);
findViewById(R.id.logout_items).setVisibility(View.GONE);
}
}
private void showSendCodeButton(){
findViewById(R.id.phone_auth_items).setVisibility(View.VISIBLE);
findViewById(R.id.phone_auth_code_items).setVisibility(View.GONE);
findViewById(R.id.logout_items).setVisibility(View.GONE);
}
private void showSingInButtons(){
findViewById(R.id.phone_auth_items).setVisibility(View.GONE);
findViewById(R.id.phone_auth_code_items).setVisibility(View.GONE);
findViewById(R.id.logout_items).setVisibility(View.VISIBLE);
}
private void initButtons(){
findViewById(R.id.phone_auth_items).setVisibility(View.GONE);
findViewById(R.id.phone_auth_code_items).setVisibility(View.GONE);
findViewById(R.id.logout_items).setVisibility(View.GONE);
}
}
And why are you pasting your code? Attach a file . dont paste it.