问:
Why can't I push from PyCharm
I'm a new GitHub user, and this question may be a trivial newbie problem. So I apologize in advance.

I'm using PyCharm for a Python project. I've set up a Git repository for the project and uploaded the files manually through the Git website. I also linked the repository to my PyCharm project.

When I modify a file, PyCharm allows me to "commit" it, but when I try to "push" it, I get a PyCharm pop-up error message saying "Push rejected." No further information is provided. How do I figure out what went wrong -- and how to fix it?

Thanks.

答:
If you manually uploaded files to the Github by dropping them, it now likely has a different history than your local files.

One way you could get around this is to store all of your changes in a different folder, do a git pull in pycharm, abandoning your changes so you are up to date with origin/master, then commit the files and push as you have been doing.

Title: Why can't I push from PyCharm


来源: stackexchange

问:
How to programmatically grant the "draw over other apps" permission in android?
How can I programmatically grant the permission in Settings -> Apps -> Draw over other apps in Android? I want to use system alert window but unable to in Android Marshmallow without forcing the user to go through the Settings app and grant the permission first.

答:
```<code>if (!Settings.canDrawOverlays(this)) {
    Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
    Uri.parse("package:" + getPackageName()));
    startActivityForResult(intent, 0);
}
</code>```
```<code><uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
if (!Settings.canDrawOverlays(this)) {
    Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
    Uri.parse("package:" + getPackageName()));
    startActivityForResult(intent, 0);
}

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

ContentLicense: CC BY-SA 4.0


问:
componentDidMount not getting props value
I'm performing the change password option with react-redux-firestore. Password changing is working fine if everything entered is correct. If any authentication error receive, error is dispatched and that should be displayed to the user.  Whenever authentication error received I was handling it as follows to show error message within render

```<code>{authError ? this.openSnackbar({ message: '{authError}' }) : null}
</code>```

but this makes a infinite loop.

Later added componentDidMount() method. This will prevent from looping through, but I'm not able to show the error message.

```<code>    componentDidMount = () => {
        const { authError } = this.props;
        console.log(authError)
        if (authError) {
            this.setState(
                {
                    loading: false,
                    message: '{authError}',
                    open: true
                },
                () => {
                    alert(this.state.open);
                }
            )
        }

    };
</code>```

when I do console.log(authError).. it's not showing the error message.

on button click how can I show the error message?

Any help Appreciated.

change password component

```<code>import React, { Component } from 'react'
import { Redirect } from 'react-router-dom'
import IconButton from '@material-ui/core/IconButton';
import { connect } from 'react-redux'
import { compose } from 'redux'
import { changePassword } from '../../store/actions/auth'

const styles = {

    textField: {
        fontSize: '5px'
    },

};

class ChangePassword extends Component {
    constructor(props) {
        super(props);
        this.state = {
            loading: false,
            open: false,
            message: '',
            cp_currentPassword: '',
            cp_newPassword: '',
            cp_confirmPassword: ''
        }
    }
    componentDidMount = () => {
        const { authError } = this.props;
        console.log('did mount called')
        console.log(authError)
        if (authError) {
            this.setState(
                {
                    loading: false,
                    message: '{authError}',
                    open: true
                },
                () => {
                    alert(this.state.open);
                }
            )
        }

    };
    handleChange = (e) => {
        this.setState({
            [e.target.id]: e.target.value
        })
    }

    openSnackbar = ({ message }) => {
        this.setState({
            open: true,
            message
        });
    };
    handleSubmit = (e) => {
        e.preventDefault();
        let curpass = this.state.cp_currentPassword
        let newpass = this.state.cp_newPassword
        this.setState({ loading: true });
        this.props.changePassword(curpass, newpass, this.passwordUpdated)
    }
    passwordUpdated = () => {
        this.setState({
            message: 'Password changed Successfully.!',
            open: true,
            loading: false
        });
    };

    render() {
        const { classes, auth, authError } = this.props;

        console.log(authError)
        const { loading } = this.state;
        const message = (
            <span
                id="snackbar-message-id"
                dangerouslySetInnerHTML={{ __html: this.state.message }}
            />
        );
        if (!auth.uid) return <Redirect to='/signin' />
        return (
            <div>
                {/* {authError ? this.openSnackbar({ message: '{authError}' }) : null} */}

                <GridContainer>
                    <GridItem xs={12} sm={12} md={12}>

                        <Card>
                            <CardHeader color="warning">
                                <h4 className={classes.cardTitleWhite}>Change Password</h4>
                            </CardHeader>
                            <form >
                                <GridContainer>
                                    <GridItem xs={12} sm={12} md={6}>
                                        <CardBody>
                                            <GridContainer>
                                                <GridItem xs={12} sm={12} md={12}>

                                                    <TextField
                                                        id="cp_currentPassword"
                                                        label="Current Password"
                                                        type="password"
                                                        fullWidth
                                                        className={classes.textField}
                                                        value={this.state.cp_currentPassword}
                                                        onChange={this.handleChange}
                                                        margin="normal"
                                                        required={true}
                                                    />
                                                </GridItem>

                                                <GridItem xs={12} sm={12} md={12}>
                                                    <TextField
                                                        id="cp_newPassword"
                                                        label="New Password"
                                                        type="password"
                                                        fullWidth
                                                        className={classes.textField}
                                                        value={this.state.cp_newPassword}
                                                        onChange={this.handleChange}
                                                        margin="normal"
                                                        required={true}
                                                    />
                                                </GridItem>
                                                <GridItem xs={12} sm={12} md={12}>
                                                    <TextField
                                                        id="cp_confirmPassword"
                                                        label="Confirm Password"
                                                        type="password"
                                                        fullWidth
                                                        className={classes.textField}
                                                        value={this.state.cp_confirmPassword}
                                                        onChange={this.handleChange}
                                                        margin="normal"
                                                        required={true}
                                                    />
                                                </GridItem>
                                            </GridContainer>

                                        </CardBody>
                                        <CardFooter>

                                            <Button color="warning" onClick={(e) => this.handleSubmit(e)} disabled={loading}>
                                                {loading && <CircularProgress style={{ color: 'white', height: '20px', width: '20px', marginRight: '10px' }} />}
                                                Change Password
                      </Button>
                                        </CardFooter>
                                    </GridItem>
                                </GridContainer>
                            </form>
                        </Card>

                    </GridItem>

                </GridContainer>

                <Snackbar
                    open={this.state.open}
                    anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
                    message={message}
                    variant="error"
                    onClose={() => this.setState({ open: false, message: '' })}
                    action={
                        <IconButton
                            key="close"
                            aria-label="Close"
                            color="inherit"
                            className={classes.close}
                            onClick={() => this.setState({ open: false, message: '' })}
                        >
                            <CloseIcon className={classes.icon} />
                        </IconButton>
                    }
                    autoHideDuration={3000}
                />
            </div>
        )
    }
}
const mapstateToProps = (state) => {
    return {
        auth: state.firebase.auth,
        authError: state.authroot.autherr
    }
}
const mapDispatchtoProps = (dispatch, getState) => {
    return {
        changePassword: (currentPassword, newPassword, passwordUpdated) => { dispatch(changePassword(currentPassword, newPassword, passwordUpdated)) }
    }
}
export default compose(
    withStyles(styles),
    connect(mapstateToProps, mapDispatchtoProps)
)(ChangePassword);
</code>```

auth action

```<code>export const changePassword = (currentPassword, newPassword, func) => {
    return (dispatch, getState, { getFirebase }) => {
        const firebase = getFirebase();
        var user = firebase.auth().currentUser;
        var cred = firebase.auth.EmailAuthProvider.credential(
            user.email, currentPassword);
            // reauthenticateAndRetrieveDataWithCredential
        user.reauthenticateWithCredential(cred)
            .then(() => {
                user.updatePassword(newPassword).then(() => {
                    console.log("Password updated!");
                    func();
                }).catch((error) => { dispatch({ type: 'CHANGEPASSWORD_ERR', error }) });
            }).catch((error) => {
                dispatch({ type: 'CHANGEPASSWORD_CURRPSW_ERR', error })
            });

    }
}
</code>```

auth reducer

```<code> case 'CHANGEPASSWORD_SUCCESS':
            return {
                ...state,
                 //action.func

            };
            case 'CHANGEPASSWORD_CURRPSW_ERR':
            return {
                ...state,
                autherr: action.error.message

            };
            case 'CHANGEPASSWORD_ERR':
                return {
                    ...state,
                    autherr: action.error.message

                };
</code>```

答:
I think what you're trying to achieve is not props-related, but state-related (Redux state which is passed to props). When the state changes, you want an error to pop. In that case, you should use componentDidUpdate and not componentDidMount because the latter will just run once when the component mounts.

```<code>    componentDidUpdate = (prevProps) => {
        const { authError } = this.props;
        console.log(authError)
        if (authError != prevProps.authError) {
            this.setState(
                {
                    loading: false,
                    message: authError,
                    open: true
                },
                () => {
                    alert(this.state.open);
                }
            )
        }

    };
</code>```

Body:
I'm performing the change password option with react-redux-firestore. Password changing is working fine if everything entered is correct. If any authentication error receive, error is dispatched and that should be displayed to the user.  Whenever authentication error received I was handling it as follows to show error message within render

{authError ? this.openSnackbar({ message: '{authError}' }) : null}

but this makes a infinite loop.

Later added componentDidMount() method. This will prevent from looping through, but I'm not able to show the error message.

    componentDidMount = () => {
        const { authError } = this.props;
        console.log(authError)
        if (authError) {
            this.setState(
                {
                    loading: false,
                    message: '{authError}',
                    open: true
                },
                () => {
                    alert(this.state.open);
                }
            )
        }

    };

when I do console.log(authError).. it's not showing the error message.

on button click how can I show the error message?

Any help Appreciated.

change password component

import React, { Component } from 'react'
import { Redirect } from 'react-router-dom'
import IconButton from '@material-ui/core/IconButton';
import { connect } from 'react-redux'
import { compose } from 'redux'
import { changePassword } from '../../store/actions/auth'

const styles = {

    textField: {
        fontSize: '5px'
    },

};

class ChangePassword extends Component {
    constructor(props) {
        super(props);
        this.state = {
            loading: false,
            open: false,
            message: '',
            cp_currentPassword: '',
            cp_newPassword: '',
            cp_confirmPassword: ''
        }
    }
    componentDidMount = () => {
        const { authError } = this.props;
        console.log('did mount called')
        console.log(authError)
        if (authError) {
            this.setState(
                {
                    loading: false,
                    message: '{authError}',
                    open: true
                },
                () => {
                    alert(this.state.open);
                }
            )
        }

    };
    handleChange = (e) => {
        this.setState({
            [e.target.id]: e.target.value
        })
    }

    openSnackbar = ({ message }) => {
        this.setState({
            open: true,
            message
        });
    };
    handleSubmit = (e) => {
        e.preventDefault();
        let curpass = this.state.cp_currentPassword
        let newpass = this.state.cp_newPassword
        this.setState({ loading: true });
        this.props.changePassword(curpass, newpass, this.passwordUpdated)
    }
    passwordUpdated = () => {
        this.setState({
            message: 'Password changed Successfully.!',
            open: true,
            loading: false
        });
    };

    render() {
        const { classes, auth, authError } = this.props;

        console.log(authError)
        const { loading } = this.state;
        const message = (

        );
        if (!auth.uid) return <Redirect to='/signin' />
        return (

                {/* {authError ? this.openSnackbar({ message: '{authError}' }) : null} */}

                <GridContainer>
                    <GridItem xs={12} sm={12} md={12}>

                        <Card>
                            <CardHeader color="warning">

Change Password

                            </CardHeader>
                            <form >
                                <GridContainer>
                                    <GridItem xs={12} sm={12} md={6}>
                                        <CardBody>
                                            <GridContainer>
                                                <GridItem xs={12} sm={12} md={12}>

                                                    <TextField
                                                        id="cp_currentPassword"
                                                        label="Current Password"
                                                        type="password"
                                                        fullWidth
                                                        className={classes.textField}
                                                        value={this.state.cp_currentPassword}
                                                        onChange={this.handleChange}
                                                        margin="normal"
                                                        required={true}
                                                    />
                                                </GridItem>

                                                <GridItem xs={12} sm={12} md={12}>
                                                    <TextField
                                                        id="cp_newPassword"
                                                        label="New Password"
                                                        type="password"
                                                        fullWidth
                                                        className={classes.textField}
                                                        value={this.state.cp_newPassword}
                                                        onChange={this.handleChange}
                                                        margin="normal"
                                                        required={true}
                                                    />
                                                </GridItem>
                                                <GridItem xs={12} sm={12} md={12}>
                                                    <TextField
                                                        id="cp_confirmPassword"
                                                        label="Confirm Password"
                                                        type="password"
                                                        fullWidth
                                                        className={classes.textField}
                                                        value={this.state.cp_confirmPassword}
                                                        onChange={this.handleChange}
                                                        margin="normal"
                                                        required={true}
                                                    />
                                                </GridItem>
                                            </GridContainer>

                                        </CardBody>
                                        <CardFooter>

                                            <Button color="warning" onClick={(e) => this.handleSubmit(e)} disabled={loading}>
                                                {loading && <CircularProgress style={{ color: 'white', height: '20px', width: '20px', marginRight: '10px' }} />}
                                                Change Password
                      </Button>
                                        </CardFooter>
                                    </GridItem>
                                </GridContainer>
                            </form>
                        </Card>

                    </GridItem>

                </GridContainer>

                <Snackbar
                    open={this.state.open}
                    anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
                    message={message}
                    variant="error"
                    onClose={() => this.setState({ open: false, message: '' })}
                    action={
                        <IconButton
                            key="close"
                            aria-label="Close"
                            color="inherit"
                            className={classes.close}
                            onClick={() => this.setState({ open: false, message: '' })}
                        >
                            <CloseIcon className={classes.icon} />
                        </IconButton>
                    }
                    autoHideDuration={3000}
                />

        )
    }
}
const mapstateToProps = (state) => {
    return {
        auth: state.firebase.auth,
        authError: state.authroot.autherr
    }
}
const mapDispatchtoProps = (dispatch, getState) => {
    return {
        changePassword: (currentPassword, newPassword, passwordUpdated) => { dispatch(changePassword(currentPassword, newPassword, passwordUpdated)) }
    }
}
export default compose(
    withStyles(styles),
    connect(mapstateToProps, mapDispatchtoProps)
)(ChangePassword);

auth action

export const changePassword = (currentPassword, newPassword, func) => {
    return (dispatch, getState, { getFirebase }) => {
        const firebase = getFirebase();
        var user = firebase.auth().currentUser;
        var cred = firebase.auth.EmailAuthProvider.credential(
            user.email, currentPassword);
            // reauthenticateAndRetrieveDataWithCredential
        user.reauthenticateWithCredential(cred)
            .then(() => {
                user.updatePassword(newPassword).then(() => {
                    console.log("Password updated!");
                    func();
                }).catch((error) => { dispatch({ type: 'CHANGEPASSWORD_ERR', error }) });
            }).catch((error) => {
                dispatch({ type: 'CHANGEPASSWORD_CURRPSW_ERR', error })
            });

    }
}

auth reducer

 case 'CHANGEPASSWORD_SUCCESS':
            return {
                ...state,
                 //action.func

            };
            case 'CHANGEPASSWORD_CURRPSW_ERR':
            return {
                ...state,
                autherr: action.error.message

            };
            case 'CHANGEPASSWORD_ERR':
                return {
                    ...state,
                    autherr: action.error.message

                };

Body:
I think what you're trying to achieve is not props-related, but state-related (Redux state which is passed to props). When the state changes, you want an error to pop. In that case, you should use componentDidUpdate and not componentDidMount because the latter will just run once when the component mounts.

    componentDidUpdate = (prevProps) => {
        const { authError } = this.props;
        console.log(authError)
        if (authError != prevProps.authError) {
            this.setState(
                {
                    loading: false,
                    message: authError,
                    open: true
                },
                () => {
                    alert(this.state.open);
                }
            )
        }

    };


问:
Checking If MySQL Rows Returned>10 and if so running some code, if not running a different piece of code
I have the code below which is supposed to check the database for entries with a certain username which is working but when I try to add some code to check if the rows returned is greater than 10 and then run some code to limit the number of rows to 10 and then if not run another piece of code which will display all the rows.

Code:

```<code>    mysql_select_db("blahblah", $con); //connect to database..
    $username =  basename(dirname(__FILE__));
    $username = mysql_real_escape_string($username);
    $checkres = mysql_query("SELECT COUNT link, notes, titles, color FROM links WHERE username='" . $username . "';");
    if ($checkres>10)
    {
    $resultsmall = mysql_query("SELECT link, notes, titles, color FROM links WHERE username='" . $username . "' LIMIT 10;");
    while ($rowsmall = mysql_fetch_array($resultsmall)) { //loop
      extract($rowsmall);
      $htmlsmall .= "
//code goes here to format results
                ";
    echo $htmlsmall; //display results...
    }
    }
    else {
    $result = mysql_query("SELECT link, notes, titles, color FROM links WHERE username='" . $username . "';");
    while ($row = mysql_fetch_array($result)) { //loop
      extract($row);
      $html .= "
            //code goes here to format results
                ";
    echo $html; //display results...
    }
    }
    mysql_close($con); //close db..
</code>```

But it just displays two times the number of rows in the database instead of either limiting it or displaying them all. How would I fix this? The //code goes here for formatting isn't important it just formats the code so that it looks nice and displays it in a box...

Thanks!

EDIT:

I now have this code but it now doesn't display anything at all? Can someone help:

Code:

```<code>mysql_select_db("blahblah", $con); //connect to database..
$username =  basename(dirname(__FILE__));
$username = mysql_real_escape_string($username);
$sql = "SELECT SQL_CALC_FOUND_ROWS link, notes, titles, color FROM links WHERE username='" . $username . "' LIMIT 10";
$result = mysql_query($sql) or die("MySQL error: " . mysql_error());

$subsql = "SELECT found_rows() AS foundrows;";
$subresult = mysql_query($subsql) or die("MySQL error: " . mysql_error());
$found_rows = $subresult['foundrows'];

if($found_rows > 10)
{
  while($row = mysql_fetch_array($result))
  {
    extract ($row);
    $html .= "
      //getting values from columns and then formatting them goes here
    ";

    echo "Only 10 is allowed.";
  }
}
else
{
  while($row = mysql_fetch_array($result))
  {
    extract($row);
    $html .= "
      //getting values from columns and then formatting them goes here
    ";
  }
}
mysql_close($con); //close db..
</code>```

Thanks!

EDIT 2 (12 April 14:03 2011 GMT):

I now have this code which has been kindly helped by Col. Shrapnel but it doesn't display anything for me and I don't know why, please could some help.

Code:

```<code>mysql_select_db("blahblah", $con); //connect to database..
$username =  basename(dirname(__FILE__));
$username = mysql_real_escape_string($username);
$sql = "SELECT link, notes, titles, color FROM links WHERE username='$username' LIMIT 10";
$res = mysql_query($sql);
if (mysql_num_rows() == 10) {
while ($row = mysql_fetch_array($res)) {
  extract($row);
  $htmlsmall .= "
</code>```

=
      ";
        $htmlfree .= "Only 10 is allowed.";
    echo $htmlsmall;
    echo $htmlfree;
    }
    }
    else {
    while ($row = mysql_fetch_array($res)) {
      extract($rowsmall);
      $htmlsmall .= "

```<code>  ";
echo $htmlsmall;
}
}
</code>```

Now if I view the page source I can see these 2 errors:

```<code><b>Warning</b>:  Wrong parameter count for mysql_num_rows() in <b>//url was here</b> on line <b>109</b><br />

<b>Warning</b>:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>//url to file goes here</b> on line <b>125</b><br />
</code>```

Line 109 is this: if (mysql_num_rows() == 10) {

Line 125 is this: while ($row = mysql_fetch_array($res)) {

(Those lines are in the code above)

Please could someone help me with this?

Thanks!

答:
I try to add some code to check if the rows returned is greater than 10 and then run some code to limit the number of rows to 10

It makes no sense.

Just run your query with LIMIT 10 and you will get your data.

```<code>mysql_select_db("blahblah", $con); //connect to database..
$username =  basename(dirname(__FILE__));
$username = mysql_real_escape_string($username);
$sql = "SELECT * FROM links WHERE username='$username' LIMIT 10";
$res = mysql_query($sql) or trigger_error(mysql_error()." ".$sql);
while ($row = mysql_fetch_array($res)) {
  extract($rowsmall);
  $htmlsmall .= ""; //code goes here to format results
}
echo $htmlsmall;
</code>```

That's all.
If you still want to echo "Only 10 is allowed." (dunno why though) you can add these 3 lines below

```<code>if (mysql_num_rows($res) == 10) {
  echo "Only 10 is allowed.";
}
</code>```

However I see not much point in it.

Also note that your program design is probably wrong, as you're apparently copying this file for the every user in your system

Body:
I have the code below which is supposed to check the database for entries with a certain username which is working but when I try to add some code to check if the rows returned is greater than 10 and then run some code to limit the number of rows to 10 and then if not run another piece of code which will display all the rows.

Code:

    mysql_select_db("blahblah", $con); //connect to database..
    $username =  basename(dirname(__FILE__));
    $username = mysql_real_escape_string($username);
    $checkres = mysql_query("SELECT COUNT link, notes, titles, color FROM links WHERE username='" . $username . "';");
    if ($checkres>10)
    {
    $resultsmall = mysql_query("SELECT link, notes, titles, color FROM links WHERE username='" . $username . "' LIMIT 10;");
    while ($rowsmall = mysql_fetch_array($resultsmall)) { //loop
      extract($rowsmall);
      $htmlsmall .= "
//code goes here to format results
                ";
    echo $htmlsmall; //display results...
    }
    }
    else {
    $result = mysql_query("SELECT link, notes, titles, color FROM links WHERE username='" . $username . "';");
    while ($row = mysql_fetch_array($result)) { //loop
      extract($row);
      $html .= "
            //code goes here to format results
                ";
    echo $html; //display results...
    }
    }
    mysql_close($con); //close db..

But it just displays two times the number of rows in the database instead of either limiting it or displaying them all. How would I fix this? The //code goes here for formatting isn't important it just formats the code so that it looks nice and displays it in a box...

Thanks!

EDIT:

I now have this code but it now doesn't display anything at all? Can someone help:

Code:

mysql_select_db("blahblah", $con); //connect to database..
$username =  basename(dirname(__FILE__));
$username = mysql_real_escape_string($username);
$sql = "SELECT SQL_CALC_FOUND_ROWS link, notes, titles, color FROM links WHERE username='" . $username . "' LIMIT 10";
$result = mysql_query($sql) or die("MySQL error: " . mysql_error());

$subsql = "SELECT found_rows() AS foundrows;";
$subresult = mysql_query($subsql) or die("MySQL error: " . mysql_error());
$found_rows = $subresult['foundrows'];

if($found_rows > 10)
{
  while($row = mysql_fetch_array($result))
  {
    extract ($row);
    $html .= "
      //getting values from columns and then formatting them goes here
    ";

    echo "Only 10 is allowed.";
  }
}
else
{
  while($row = mysql_fetch_array($result))
  {
    extract($row);
    $html .= "
      //getting values from columns and then formatting them goes here
    ";
  }
}
mysql_close($con); //close db..

Thanks!

EDIT 2 (12 April 14:03 2011 GMT):

I now have this code which has been kindly helped by Col. Shrapnel but it doesn't display anything for me and I don't know why, please could some help.

Code:

mysql_select_db("blahblah", $con); //connect to database..
$username =  basename(dirname(__FILE__));
$username = mysql_real_escape_string($username);
$sql = "SELECT link, notes, titles, color FROM links WHERE username='$username' LIMIT 10";
$res = mysql_query($sql);
if (mysql_num_rows() == 10) {
while ($row = mysql_fetch_array($res)) {
  extract($row);
  $htmlsmall .= "

=
      ";
        $htmlfree .= "Only 10 is allowed.";
    echo $htmlsmall;
    echo $htmlfree;
    }
    }
    else {
    while ($row = mysql_fetch_array($res)) {
      extract($rowsmall);
      $htmlsmall .= "

  ";
echo $htmlsmall;
}
}

Now if I view the page source I can see these 2 errors:

Warning:  Wrong parameter count for mysql_num_rows() in //url was here on line 109

Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in //url to file goes here on line 125

Line 109 is this: if (mysql_num_rows() == 10) {

Line 125 is this: while ($row = mysql_fetch_array($res)) {

(Those lines are in the code above)

Please could someone help me with this?

Thanks!

Body:
I try to add some code to check if the rows returned is greater than 10 and then run some code to limit the number of rows to 10

It makes no sense.

Just run your query with LIMIT 10 and you will get your data.

mysql_select_db("blahblah", $con); //connect to database..
$username =  basename(dirname(__FILE__));
$username = mysql_real_escape_string($username);
$sql = "SELECT * FROM links WHERE username='$username' LIMIT 10";
$res = mysql_query($sql) or trigger_error(mysql_error()." ".$sql);
while ($row = mysql_fetch_array($res)) {
  extract($rowsmall);
  $htmlsmall .= ""; //code goes here to format results
}
echo $htmlsmall;

That's all.
If you still want to echo "Only 10 is allowed." (dunno why though) you can add these 3 lines below

if (mysql_num_rows($res) == 10) {
  echo "Only 10 is allowed.";
}

However I see not much point in it.

Also note that your program design is probably wrong, as you're apparently copying this file for the every user in your system


问:
How to fix 'admob dependency' error in flutter
I was using ad_mob dependency:0.5.2 for my app to run and it worked well but when I tried building apk through flutter build apk --release it shown me error-

```What went wrong:
Execution failed for task ':firebase_admob:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
Output: C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\merged\release\values\values.xml:208: error: resource android:attr/fontVaria
tionSettings not found.
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\merged\release\values\values.xml:209: error: resource android:attr/ttcIndex not found
.
error: failed linking references.

Command: C:\Users\Azhan Khan.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\776897f19ca1f56b9e14581d21b8d456\aapt2-3.2.1-4818971-windows\aapt2.exe link -I
C:\Users\Azhan Khan\AppData\Local\Android\sdk\platforms\android-27\android.jar
--manifest
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\aapt_friendly_merged_manifests\release\processReleaseManifest\aapt\AndroidManifes
t.xml
-o
C:\Users\AZHANK~1\AppData\Local\Temp\aapt-8063817246819914891-out
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\color_common_google_signin_btn_text_dark.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\color_common_google_signin_btn_text_light.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_common_google_signin_btn_text_light_normal
_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_googleg_disabled_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_googleg_standard_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_low_normal.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_low_pressed.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_normal.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_normal_pressed.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notify_panel_notification_icon_bg.png.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_icon_dark_normal
_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_icon_light_norma
l_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_text_dark_normal
_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_text_light_norma
l_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_googleg_disabled_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_googleg_standard_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_dark.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_dark_focused.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_dark_normal.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_disabled.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_light.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_light_focused.xml.fla
t
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_light_normal.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_dark.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_dark_focused.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_dark_normal.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_disabled.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_light.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_light_focused.xml.fla
t
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_light_normal.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_bg.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_bg_low.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_icon_background.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_tile_bg.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v16_notification_template_custom_big.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_action_tombstone.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_template_custom_big.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_template_icon_group.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_browser_actions_context_menu_page.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_browser_actions_context_menu_row.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_action_tombstone.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_media_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_media_cancel_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media_custom.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media_narrow.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media_narrow_custom.xml.fla
t
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_icon_group.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_lines_media.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_media.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_media_custom.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_part_chronometer.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_part_time.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-af_values-af.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-am_values-am.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ar_values-ar.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-as_values-as.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-az_values-az.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-b+sr+Latn_values-b+sr+Latn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-be_values-be.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-bg_values-bg.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-bn_values-bn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-bs_values-bs.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ca_values-ca.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-cs_values-cs.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-da_values-da.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-de_values-de.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-el_values-el.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rAU_values-en-rAU.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rCA_values-en-rCA.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rGB_values-en-rGB.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rIN_values-en-rIN.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rXC_values-en-rXC.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-es-rUS_values-es-rUS.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-es_values-es.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-et_values-et.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-eu_values-eu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fa_values-fa.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fi_values-fi.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fr-rCA_values-fr-rCA.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fr_values-fr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-gl_values-gl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-gu_values-gu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hi_values-hi.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hr_values-hr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hu_values-hu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hy_values-hy.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-in_values-in.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-is_values-is.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-it_values-it.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-iw_values-iw.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ja_values-ja.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ka_values-ka.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-kk_values-kk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-km_values-km.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-kn_values-kn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ko_values-ko.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ky_values-ky.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-lo_values-lo.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-lt_values-lt.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-lv_values-lv.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-mk_values-mk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ml_values-ml.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-mn_values-mn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-mr_values-mr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ms_values-ms.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-my_values-my.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-nb_values-nb.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ne_values-ne.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-nl_values-nl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-or_values-or.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pa_values-pa.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pl_values-pl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pt-rBR_values-pt-rBR.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pt-rPT_values-pt-rPT.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pt_values-pt.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ro_values-ro.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ru_values-ru.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-si_values-si.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sk_values-sk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sl_values-sl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sq_values-sq.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sr_values-sr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sv_values-sv.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sw_values-sw.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ta_values-ta.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-te_values-te.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-th_values-th.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-tl_values-tl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-tr_values-tr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-uk_values-uk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ur_values-ur.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-uz_values-uz.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-v16_values-v16.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-v21_values-v21.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-v24_values-v24.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-vi_values-vi.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zh-rCN_values-zh-rCN.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zh-rHK_values-zh-rHK.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zh-rTW_values-zh-rTW.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zu_values-zu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values_values.arsc.flat
--auto-add-overlay
--non-final-ids
-0
apk
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 38s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 46.7s

The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
```

But when I changed the dependency version to 0.8.0+4 the flutter build apk --release command works and I get the apk but it crashes on startup.

答:
You have to update firebase_admob to version 0.9.0 and change following files:

Android - https://pub.dev/packages/firebase_admob#androidmanifest-changes

Put following into AndroidManifest.xml file just below <application> tag:

```<code><meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
</code>```

Replace [ADMOB_APP_ID] with app (not the unit) identifier from AdMob dashboard.

iOS - https://pub.dev/packages/firebase_admob#infoplist-changes

Put following into Info.plist file:

```<code><key>GADApplicationIdentifier</key>
<string>[ADMOB_APP_ID]</string>
</code>```

Replace [ADMOB_APP_ID] with app (not the unit) identifier from AdMob dashboard.

Additionally if your app crashes for some reason, you can always run adb logcat to see the full logs on what happened.

Body:
I was using ad_mob dependency:0.5.2 for my app to run and it worked well but when I tried building apk through flutter build apk --release it shown me error-

What went wrong:
Execution failed for task ':firebase_admob:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
Output: C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\merged\release\values\values.xml:208: error: resource android:attr/fontVaria
tionSettings not found.
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\merged\release\values\values.xml:209: error: resource android:attr/ttcIndex not found
.
error: failed linking references.

Command: C:\Users\Azhan Khan.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\776897f19ca1f56b9e14581d21b8d456\aapt2-3.2.1-4818971-windows\aapt2.exe link -I
C:\Users\Azhan Khan\AppData\Local\Android\sdk\platforms\android-27\android.jar
--manifest
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\aapt_friendly_merged_manifests\release\processReleaseManifest\aapt\AndroidManifes
t.xml
-o
C:\Users\AZHANK~1\AppData\Local\Temp\aapt-8063817246819914891-out
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\color_common_google_signin_btn_text_dark.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\color_common_google_signin_btn_text_light.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_common_google_signin_btn_text_light_normal
_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_googleg_disabled_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_googleg_standard_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_low_normal.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_low_pressed.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_normal.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notification_bg_normal_pressed.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xhdpi-v4_notify_panel_notification_icon_bg.png.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_icon_dark_normal
_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_icon_light_norma
l_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_text_dark_normal
_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_common_google_signin_btn_text_light_norma
l_background.9.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_googleg_disabled_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable-xxhdpi-v4_googleg_standard_color_18.png.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_dark.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_dark_focused.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_dark_normal.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_disabled.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_light.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_light_focused.xml.fla
t
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_icon_light_normal.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_dark.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_dark_focused.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_dark_normal.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_disabled.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_light.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_light_focused.xml.fla
t
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_common_google_signin_btn_text_light_normal.xml.flat

-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_bg.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_bg_low.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_icon_background.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\drawable_notification_tile_bg.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v16_notification_template_custom_big.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_action_tombstone.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_template_custom_big.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout-v21_notification_template_icon_group.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_browser_actions_context_menu_page.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_browser_actions_context_menu_row.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_action_tombstone.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_media_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_media_cancel_action.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media_custom.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media_narrow.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_big_media_narrow_custom.xml.fla
t
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_icon_group.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_lines_media.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_media.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_media_custom.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_part_chronometer.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\layout_notification_template_part_time.xml.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-af_values-af.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-am_values-am.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ar_values-ar.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-as_values-as.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-az_values-az.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-b+sr+Latn_values-b+sr+Latn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-be_values-be.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-bg_values-bg.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-bn_values-bn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-bs_values-bs.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ca_values-ca.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-cs_values-cs.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-da_values-da.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-de_values-de.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-el_values-el.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rAU_values-en-rAU.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rCA_values-en-rCA.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rGB_values-en-rGB.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rIN_values-en-rIN.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-en-rXC_values-en-rXC.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-es-rUS_values-es-rUS.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-es_values-es.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-et_values-et.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-eu_values-eu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fa_values-fa.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fi_values-fi.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fr-rCA_values-fr-rCA.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-fr_values-fr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-gl_values-gl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-gu_values-gu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hi_values-hi.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hr_values-hr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hu_values-hu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-hy_values-hy.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-in_values-in.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-is_values-is.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-it_values-it.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-iw_values-iw.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ja_values-ja.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ka_values-ka.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-kk_values-kk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-km_values-km.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-kn_values-kn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ko_values-ko.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ky_values-ky.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-lo_values-lo.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-lt_values-lt.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-lv_values-lv.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-mk_values-mk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ml_values-ml.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-mn_values-mn.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-mr_values-mr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ms_values-ms.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-my_values-my.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-nb_values-nb.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ne_values-ne.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-nl_values-nl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-or_values-or.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pa_values-pa.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pl_values-pl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pt-rBR_values-pt-rBR.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pt-rPT_values-pt-rPT.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-pt_values-pt.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ro_values-ro.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ru_values-ru.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-si_values-si.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sk_values-sk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sl_values-sl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sq_values-sq.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sr_values-sr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sv_values-sv.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-sw_values-sw.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ta_values-ta.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-te_values-te.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-th_values-th.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-tl_values-tl.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-tr_values-tr.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-uk_values-uk.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-ur_values-ur.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-uz_values-uz.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-v16_values-v16.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-v21_values-v21.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-v24_values-v24.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-vi_values-vi.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zh-rCN_values-zh-rCN.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zh-rHK_values-zh-rHK.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zh-rTW_values-zh-rTW.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values-zu_values-zu.arsc.flat
-R
C:\Users\Azhan Khan\AndroidStudioProjects\simple_motivation\build\firebase_admob\intermediates\res\compiled\release\values_values.arsc.flat
--auto-add-overlay
--non-final-ids
-0
apk
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 38s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 46.7s

The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.

But when I changed the dependency version to 0.8.0+4 the flutter build apk --release command works and I get the apk but it crashes on startup.

Body:
You have to update firebase_admob to version 0.9.0 and change following files:

Android - https://pub.dev/packages/firebase_admob#androidmanifest-changes

Put following into AndroidManifest.xml file just below <application> tag:

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>

Replace [ADMOB_APP_ID] with app (not the unit) identifier from AdMob dashboard.

iOS - https://pub.dev/packages/firebase_admob#infoplist-changes

Put following into Info.plist file:

<key>GADApplicationIdentifier</key>
<string>[ADMOB_APP_ID]</string>

Replace [ADMOB_APP_ID] with app (not the unit) identifier from AdMob dashboard.

Additionally if your app crashes for some reason, you can always run adb logcat to see the full logs on what happened.


问:
Stop a notification using swift 3
I have a problem which involves stopping a local notification. This stop button is that so if the user starts a timer (a notification pops up once the timer runs out) and then decides they no longer need the timer, they can cancel it. The problem here is that every method I've tried does not stop the notification from going off. This is mostly because the methods are out of date. Below is my code and I was wondering whether anyone had any ideas on how to stop the notification from going off. Any help would be very much appreciated.</p>

```<code>//In the view did load section
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
        if granted {
            print("granted")
        } else {
            print("not granted")
        }
    }

//in a seperate function
let center = UNUserNotificationCenter.current()

content.title = "Local notification"
content.categoryIdentifier = "alarm"
content.userInfo = ["customData": "fizzbuzz"]
content.sound = UNNotificationSound.init(named: "1.mp3")
content.badge = 1

let trigger = UNTimeIntervalNotificationTrigger(timeInterval: time, repeats: false)
let request = UNNotificationRequest(identifier: "requestAlarm", content: content, trigger: trigger)
center.add(request)

center.delegate = self
</code>```

答:
You can stop certain notification with:

```<code>center.removePendingNotificationRequests(withIdentifiers: ["alarm"])
</code>```

Where "alarm" is your categoryIdentifier. This way you won't stop every notification, just the chosen one. Good stuff.
Regards.

Title: Stop a notification using swift 3

Body:
I have a problem which involves stopping a local notification. This stop button is that so if the user starts a timer (a notification pops up once the timer runs out) and then decides they no longer need the timer, they can cancel it. The problem here is that every method I've tried does not stop the notification from going off. This is mostly because the methods are out of date. Below is my code and I was wondering whether anyone had any ideas on how to stop the notification from going off. Any help would be very much appreciated.

//In the view did load section
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
        if granted {
            print("granted")
        } else {
            print("not granted")
        }
    }

//in a seperate function
let center = UNUserNotificationCenter.current()

content.title = "Local notification"
content.categoryIdentifier = "alarm"
content.userInfo = ["customData": "fizzbuzz"]
content.sound = UNNotificationSound.init(named: "1.mp3")
content.badge = 1

let trigger = UNTimeIntervalNotificationTrigger(timeInterval: time, repeats: false)
let request = UNNotificationRequest(identifier: "requestAlarm", content: content, trigger: trigger)
center.add(request)

center.delegate = self

Body:
You can stop certain notification with:

center.removePendingNotificationRequests(withIdentifiers: ["alarm"])

Where "alarm" is your categoryIdentifier. This way you won't stop every notification, just the chosen one. Good stuff.
Regards.


问:
Keycloak integration with Pingfederate
What I want to do is this:

I have keycloak integrated with my application. So when my app is launched , keycloak login page is shown to user. Now , I am trying to provide an option to login with PingFedrate. So a button to login with PingFed appears(once a new SAML provider is configured in keycloak). On PingFedrate I tried to integrate SP inititated SSO:

I added a new SP connection and there I configured it as SSP initiated SSO.  (It forced me to configure  SOAP Authentication , where I selected basic and configured random username password).  Then I downloaded metatdata.xml from this SP and imported in keycloak which autofilled the login url as : https://myserver:9031/idp/SSO.saml2 (i.e. without client id). After this when user clickon Login with PingFed - PingFed gives following error:

Unexpected System Error Sorry for the inconvenience. Please contact
  your administrator for assistance and provide the reference number
  below to help locate and correct the problem.

答:
I found the solution to this.

Firstly, we need to add SP inititated SSO in Pingfed for keycloak.

Secondly, the reason I could not make SP inititated SSO work was that keycloak's entityId should be same as Pingfed SP connection's Partner's Entity Id / Connection Id.

Keycloak, by default keeps entity id equal to url of keyloak server containing your realm. E.g

https://(keycloak-server)/auth/realms/(realm-name)

(and I could not find a way to change it through Keycloak UI)

You need to enter this URL in Pingfed.

To avoid adding this manually, you can download the keycloak config from download export tab of identity provider.

And on Pingfed , import this file.

On a side note, though I was importing it earlier, I was changing value of Partenr id to some other name as I was not aware of above restriction until I started decoding the SAML tokens in request.

Title: Keycloak integration with Pingfederate


问:
How to set margins to two div inside another div?
I want to set different margins to two divs, inside another div. The first div should appear top of the second div.

```<code><div style="position:relative">
 <div style="position: absolute;margin-top:24px">
   This should be appar top of the second div.
 </div>
 <div style="margin-top:24px">
   second div
 </div>
</div
</code>```

I used above mention code, but first div also getting margin 50, not margin 24.

How to resolve this issue?

Cannot use position:absoulte to the second div.

答:
You can use the following code:  </p>

```<code>   <div style="position:relative">
     <div style="posiotion:absolute, top:24px">
       This should be appar top of the second div.
     </div>
     <div>
       second div
     </div>
   </div>
</code>```

Body:
I want to set different margins to two divs, inside another div. The first div should appear top of the second div.

   This should be appar top of the second div.

   second div

</div

I used above mention code, but first div also getting margin 50, not margin 24.

How to resolve this issue?

Cannot use position:absoulte to the second div.

Body:
You can use the following code:

   <div style="position:relative">
     <div style="posiotion:absolute, top:24px">
       This should be appar top of the second div.
     </div>
     <div>
       second div
     </div>
   </div>


问:
render a div conditionally using props in ReactJS
I'm very new to react and I'm trying to show a message after I have submitted a post response, but it's not showing it.

Note: the POST response is working correctly. The message needs to show when the status in the app.js gets updated. It looks like the value of status is getting passed down only once when the pages renders for the first time.

APP.JS

```<code>class App extends Component {
  status = null;
  submit = async values => {
    const response = await providers.post('/providers/', {
      params: {
        values
      }
    });
    this.status = response.status;
    if (this.status === 200) {
      this.getInitialValues();
      this.myFormRef.reset();
    } else {
      console.log('ERROR: There was an error creating a new Provider');
    }
  };

  render() {
    return (
      <div className='registration-form ui container'>
        <img src={logo} alt={logo} />
        <h1>New Provider Form</h1>
        <Form
          onSubmit={this.submit}
          initialValues={this.getInitialValues()}
          ref={el => (this.myFormRef = el)}
        />
        <Status status={this.status} />
      </div>
    );
  }
</code>```

STATUS.JS

```<code>import React from 'react';
const Status = props => {
  console.log(props.status);
  if (props.status === 200) {
    return <div className='status'>Provider Successfully Registered!</div>;
  } else if (props.status > 200) {
    return <div className='status'>ERROR: Couldn't register new provider</div>;
  } else {
    return null;
  }
};

export default Status;
</code>```

答:
In order to show any updated state in react js, you have to render that variable using state. Because when you do setState in react, it automatically re-renders the component.
So, you can save your status in state like this:

```<code>class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      status: '',
    };
  }

submit = async (values) => {
    const response = await providers.post('/providers/', {
      params: {
        values
      }
    });
    this.setState({status: response.status},()=>{
       if (this.state.status === 200) {
         this.getInitialValues();
         this.myFormRef.reset();
       } else {
         console.log('ERROR: There was an error creating a new Provider');
       }
    });

  };
render() {
    return (
      <div className='registration-form ui container'>
        <img src={logo} alt={logo} />
        <h1>New Provider Form</h1>
        <Form
          onSubmit={this.submit}
          initialValues={this.getInitialValues()}
          ref={el => (this.myFormRef = el)}
        />
        <Status status={this.state.status} />
      </div>
    );
}
</code>```

Hope this helps!!

Body:
I'm very new to react and I'm trying to show a message after I have submitted a post response, but it's not showing it.

Note: the POST response is working correctly. The message needs to show when the status in the app.js gets updated. It looks like the value of status is getting passed down only once when the pages renders for the first time.

APP.JS

class App extends Component {
  status = null;
  submit = async values => {
    const response = await providers.post('/providers/', {
      params: {
        values
      }
    });
    this.status = response.status;
    if (this.status === 200) {
      this.getInitialValues();
      this.myFormRef.reset();
    } else {
      console.log('ERROR: There was an error creating a new Provider');
    }
  };

  render() {
    return (

New Provider Form

        <Form
          onSubmit={this.submit}
          initialValues={this.getInitialValues()}
          ref={el => (this.myFormRef = el)}
        />
        <Status status={this.status} />

    );
  }

STATUS.JS

import React from 'react';
const Status = props => {
  console.log(props.status);
  if (props.status === 200) {
    return
Provider Successfully Registered!
;
  } else if (props.status > 200) {
    return
ERROR: Couldn't register new provider
;
  } else {
    return null;
  }
};

export default Status;

Body:
In order to show any updated state in react js, you have to render that variable using state. Because when you do setState in react, it automatically re-renders the component.
So, you can save your status in state like this:

class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      status: '',
    };
  }

submit = async (values) => {
    const response = await providers.post('/providers/', {
      params: {
        values
      }
    });
    this.setState({status: response.status},()=>{
       if (this.state.status === 200) {
         this.getInitialValues();
         this.myFormRef.reset();
       } else {
         console.log('ERROR: There was an error creating a new Provider');
       }
    });

  };
render() {
    return (
      <div className='registration-form ui container'>
        <img src={logo} alt={logo} />
        <h1>New Provider Form</h1>
        <Form
          onSubmit={this.submit}
          initialValues={this.getInitialValues()}
          ref={el => (this.myFormRef = el)}
        />
        <Status status={this.state.status} />
      </div>
    );
}

Hope this helps!!