Undefined is not an object (evaluating 'Sn[e]') - android

I'm getting this error on Android:
I have found that line of code 'Sn[e]' in 'index.android.bundle' which I have pasted below (ctrl/command + F):
for (var An in Sn) xn[An] = Sn[An];
for (var Dn in wn) Pt(!Sn[Dn], "Event cannot be both direct and bubbling: %s", Dn), xn[Dn] = wn[Dn];
var kn = {
eventTypes: En({}, Sn, wn),
extractEvents: function(e, t, n, o) {
var r = Sn[e],
i = wn[e],
a = Pn.getPooled(r || i, t, n, o);
if (r) fn.accumulateTwoPhaseDispatches(a);
else {
if (!i) return null;
fn.accumulateDirectDispatches(a)
}
return a
}
},
jn = kn,
On = {
handleTopLevel: function(e, t, n, o) {
G(sn.extractEvents(e, t, n, o))
}
},
Mn = On,
Hn = 1,
Un = {
tagsStartAt: Hn,
tagCount: Hn,
allocateTag: function() {
for (; this.reactTagIsNativeTopRootID(Un.tagCount);) Un.tagCount++;
var e = Un.tagCount;
return Un.tagCount++, e
},
assertRootTag: function(e) {
It(this.reactTagIsNativeTopRootID(e), "Expect a native root tag, instead got %s", e)
},
reactTagIsNativeTopRootID: function(e) {
return e % 10 == 1
}
},
Fn = Un,
Wn = null,
Ln = {
injectFiberControlledHostComponent: function(e) {
Wn = e
}
},
Bn = null,
Yn = null,
Vn = {
injection: Ln,
enqueueStateRestore: function(e) {
Bn ? Yn ? Yn.push(e) : Yn = [e] : Bn = e
},
Looks like a React piece of code because it has injectFiberControlledHostComponent which seems like React Native Fiber. Any idea how I can fix this?
I started the app in android studio and no errors because the app builds and installs fine. I did see this in the android studio gradle console but it's probably not the issue:
Note:
/Users/Ben/Development/Projects/vepo/frontend/android/app/src/main/java/com/vepo/MainApplication.java
uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details.

I faced the same problem and fixed by changing app/build.gradle as:
compile "com.facebook.react:react-native:+"
to
compile ("com.facebook.react:react-native:+") {
force = true;
}
See also this: https://github.com/facebook/react-native/issues/17840

Related

How to build Android APK in Jetbrains Rider

I can't find option to build apk from xamarin project in Rider IDE. Thanks
It is not possible directly (or maybe in 2019.3, I haven't updated yet), but as far as producing release version, with consistent / automatically updated build number, zip aligned and signed apk, You can use an extra tool, like for example cake, that could leverage MSBuild and handle all the process of increasing the build number, cleaning / restoring the nugget packages, building/signing/ZipAlignin the apk, running tests, uploading the apk to your server/google.
Here is a example of such a Cake file:
#addin "Cake.AndroidAppManifest"
#addin nuget:?package=Cake.Git
#tool nuget:?package=NUnit.ConsoleRunner&version=3.9.0
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var SolutionFile = "../MyProject.sln";
var projectToBuild = "./MyProject.Droid.csproj";
var buildDir = Directory("./bin") + Directory(configuration);
var objDir = Directory("./obj") + Directory(configuration);
var pkg = "com.organisation.app";
var AndroidSDK = "/Users/Me/Library/Developer/Xamarin/android-sdk-macosx";
var AndroidBuildToolsVersion = "28.0.3";
int rc = 0;
// the build number will be set to the commit number. First commit, bn = 1,...
var buildNumber = GitLog(Directory(".."), int.MaxValue).Count;
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
CleanDirectories(objDir);
});
Task("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore(SolutionFile);
});
Task("Increase build number")
.IsDependentOn("Restore")
.Does(() =>
{
var pathToAndroidManifest = "./Properties/AndroidManifest.xml";
var manifest = DeserializeAppManifest(new FilePath(pathToAndroidManifest));
manifest.VersionCode = buildNumber;
SerializeAppManifest(new FilePath(pathToAndroidManifest), manifest);
});
Task("Build")
.IsDependentOn("Increase build number")
.Does(() =>
{
MSBuild("../MyProject.sln", new MSBuildSettings().SetConfiguration(configuration));
});
Task("Tests")
.IsDependentOn("Build")
.Does(() =>
{
});
Task("package")
.IsDependentOn("Tests")
.Does(() =>
{
// Creates the initial build of an apk.
MSBuild(projectToBuild, s => {
s.SetVerbosity(Verbosity.Quiet);
s.SetPlatformTarget(PlatformTarget.MSIL);
s.SetConfiguration(configuration);
s.WithTarget("SignAndroidPackage");
s.WithProperty("SolutionDir", "../");
});
});
Task("zipAlign")
.IsDependentOn("package")
.Does(() =>
{
Information("Zip-aligning APK");
rc = StartProcess($"{AndroidSDK}/build-tools/{AndroidBuildToolsVersion}/zipalign", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append("-f")
.Append("-v 4")
.Append($"{buildDir}/{pkg}-Signed.apk")
.Append($"{buildDir}/{pkg}.apk")
});
if (rc == 0) {
Information("APK Zip Alignment succeeded.");
} else {
var msg = "APK Zip Alignment failure.";
throw new Exception(msg);
}
});
Task("Signing")
.IsDependentOn("zipAlign")
.Does(() =>
{
var keystore = $"../keystore/release.keystore";
var pass = "*********";
Information("Signing apk...");
rc = StartProcess($"{AndroidSDK}/build-tools/{AndroidBuildToolsVersion}/apksigner", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append("sign")
.Append("--ks")
.Append(keystore)
.Append($"--ks-pass pass:{pass}")
.Append($"{buildDir}/{pkg}.apk")
});
if (rc != 0) {
var msg = "APK Signing failed.";
throw new Exception(msg);
}
});
Task("Tag")
.IsDependentOn("Signing")
.Does(() => {
Information("Adding a github tag with the build number");
GitTag(Directory(".."), $"{buildNumber}");
});
Task("Publish")
.IsDependentOn("Tag")
.Does(() =>
{
Information("Publishing with FastLane");
var jsonFile = $"../keystore/apiKey.json";
var apk = $"{buildDir}/{pkg}.apk";
Information("Publishing to google play with fastlane supply");
rc = StartProcess("fastlane", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append("supply")
.Append("--json_key")
.Append(jsonFile)
.Append("--package_name")
.Append(pkg)
.Append("--apk")
.Append(apk)
.Append("--track")
.Append("beta")
});
});
Task("Default")
.IsDependentOn("Publish");
RunTarget(target);

data displayed on my google sheet turned to undefined

I'm trying to make an android app that use google sheet as my database. But when i input the data to google sheet it turns to 'undefined'. hope someone can help me to fix this
code that contains 'undefined'
function read_all_value(request){
var ss =SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
var output = ContentService.createTextOutput(),
data = {};
//Note : here sheet is sheet name , don't get confuse with other operation
var sheet="sheet1";
data.records = readData_(ss, sheet);
var callback = request.parameters.callback;
if (callback === undefined) {
output.setContent(JSON.stringify(data));
} else {
output.setContent(callback + "(" + JSON.stringify(data) + ")");
}
output.setMimeType(ContentService.MimeType.JAVASCRIPT);
return output;
}
this code too
function readData_(ss, sheetname, properties) {
if (typeof properties == "undefined") {
properties = getHeaderRow_(ss, sheetname);
properties = properties.map(function(p) { return p.replace(/\s+/g, '_'); });
}
var rows = getDataRows_(ss, sheetname),
data = [];
for (var r = 0, l = rows.length; r < l; r++) {
var row = rows[r],
record = {};
for (var p in properties) {
record[properties[p]] = row[p];
}
data.push(record);
}
return data;
}
function getDataRows_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);
return sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues();
}
function getHeaderRow_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);
return sh.getRange(1, 1, 1, sh.getLastColumn()).getValues()[0];
}
here is my google sheet
https://docs.google.com/spreadsheets/d/1qX61V-xw3IjK8L373iTqlaSN0cf3-eh3zrpDBYHr8JQ/edit?usp=sharing
Change readData_() function code below -
for (var p in properties) {
record[properties[p]] = row[p];
}
to this -
properties.forEach(function(key, i) {
record[key] = row[i];
});

Fetching Data in Google SpreadSheets

I have a problem with this reference From this Site Using Google SpreadSheet as Database. the problem is that. the Android Application cannot fetch the data in a google spreadsheet. The Application can successfully run but couldn't find data in the Spreadsheet.
I Already Updated the codes from the android studio because of the old version used codes. I just copy and paste it and change some of it.
Codes Below:
The Script Link to fetch the Data :
https://script.google.com/macros/s/AKfycbwZJCWoQ7dpC5KwyRM9JYsjCjymQUspAfPmniOApD_CSEoc-LdP/exec?id=16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0&sheet=Sheet1
Link of the SpreadSheet :
https://docs.google.com/spreadsheets/d/16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0/edit#gid=0
This is the App Script that Fetches the data:
you can also see the app script codes here : App Script Codes.
function doGet(request) {
var output = ContentService.createTextOutput(),
data = {},
id = request.parameters.id,
sheet = request.parameters.sheet,
ss = SpreadsheetApp.openById(id);
data.records = readData_(ss, sheet);
var callback = request.parameters.callback;
if (callback === undefined) {
output.setContent(JSON.stringify(data));
} else {
output.setContent(callback + "(" + JSON.stringify(data) + ")");
}
output.setMimeType(ContentService.MimeType.JSON);
return output;
}
function readData_(ss, sheetname, properties) {
if (typeof properties == "undefined") {
properties = getHeaderRow_(ss, sheetname);
properties = properties.map(function(p) { return p.replace(/\s+/g, '_'); });
}
var rows = getDataRows_(ss, sheetname),
data = [];
for (var r = 0, l = rows.length; r < l; r++) {
var row = rows[r],
record = {};
for (var p in properties) {
record[properties[p]] = row[p];
}
data.push(record);
}
return data;
}
function getDataRows_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);
return sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues();
}
function getHeaderRow_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);
return sh.getRange(1, 1, 1, sh.getLastColumn()).getValues()[0];
}
More Codes From the Link Above or click here for not scrolling back.

CardIO Plugin - Issues with manually entering Card details on Android

I have implemented the following CardIO plugin in my Ionic App:
https://github.com/card-io/card.io-Cordova-Plugin
This works fine on iOS. However, on Android, when I use the keyboard option in the Camera Screen to manually type in the card details, it first loads the correct screen momentarily, and then jumps back to the first screen (Sign Up screen in this case) of the app. While debugging the app flow, I saw that the callback for Card IO is working fine, but there seems to be an issue when Ionic handles the event.
Any help greatly appreciated!
Following is the code in my controller:
$scope.$on('$ionicView.beforeEnter', function()
{
$scope.creditCardScanning();
}
$scope.creditCardScanning = function(){
var cardIOResponseFields = [
"cardType",
"redactedCardNumber",
"cardNumber",
"expiryMonth",
"expiryYear",
"cvv",
"postalCode"
];
var onCardIOComplete = function(response) {
for (var i = 0; i < cardIOResponseFields.length; i++) {
var field = cardIOResponseFields[i];
}
var cardName = response[cardIOResponseFields[0]].toUpperCase();
for (i = 0; i < $scope.cardtype.length; i++) {
var cardTypeDict = $scope.cardtype[i];
if(cardTypeDict.card_type_name === cardName){
document.getElementById('cardtype').selectedIndex = i;
$scope.params.card_type = cardName;
break;
}
}
document.getElementById('cardNumber').value = response[cardIOResponseFields[2]];
$scope.params.card_number = response[cardIOResponseFields[2]];
var expMonthVal = response[cardIOResponseFields[3]];
for(i=0;i < $scope.expmonth.length; i++) {
var expMonthDict = $scope.expmonth[i];
if(expMonthDict.value === expMonthVal){
document.getElementById('expmonth').selectedIndex = i;
$scope.params.expiration_month = expMonthDict.value;
break;
}
}
for (i = 0; i < $scope.expyear.length; i++) {
var expYearDict = $scope.expyear[i];
if(expYearDict.value === response[cardIOResponseFields[4]]){
document.getElementById('expyear').selectedIndex = i;
$scope.params.expiration_year = response[cardIOResponseFields[4]];
break;
}
}
document.getElementById('cvv').value = response[cardIOResponseFields[5]];
$scope.params.security_code = response[cardIOResponseFields[5]];
};
var onCardIOCancel = function() {
console.log("card.io scan cancelled");
};
var onCardIOCheck = function (canScan) {
console.log("card.io canScan? " + canScan);
var scanBtn = document.getElementById("scanBtn");
if (!canScan) {
console.log("Cannot scan card");
}
scanBtn.onclick = function (e) {
CardIO.scan({
"requireExpiry": true,
"requireCVV": true,
"requirePostalCode": false,
"shows_first_use_alert": true,
"disable_manual_entry_buttons": false
},
onCardIOComplete,
onCardIOCancel
);
}
};
CardIO.canScan(onCardIOCheck);
}
And in my view, I am calling the function to load the next page, once the card details are successfully entered and the "Next" Button is tapped.

#296 Requires extended permissions: create_event while creating fb event in titanium

All am trying to do is create an event in my titanium based android app..What is wrong with this piece of code? Has anything changed on facebooks end that needs to be checked before setting the permission? I always end up getting the alert as '#296 Requires extended permissions: create_event' Cant find anything relavent for my error code.
createEvent.addEventListener('click', function() {
var fb = require('facebook');
fb.appid = "2007090666xxxxx";
fb.permissions = ['publish_stream', 'read_stream', 'create_event'];
if (!fb.loggedIn) {
fb.authorize();
} else {
//showAI(L("createFbEvent"));
var postResult = function(e) {
var s = '';
if (e.success) {
//hideAI();
s = L("eventSuccess");
if (!e.result && !e.data) {
//hideAI();
s = L("reqCancelled");
}
} else if (e.cancelled) {
//hideAI();
s = L("reqFailTry");
} else {
//hideAI();
s = "reqFail";
if (e.error) {
s += "; " + e.error;
}
}
openAlert("Facebook", s);
win.close();
};
var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'logo.png');
var blob = f.read();
var data = {
name : nameField.value,
description : descField.value,
start_time : userRows.fieldByName('fbStart'),
end_time : userRows.fieldByName('fbEnd'),
picture : blob,
location : "GLand"
};
fb.requestWithGraphPath('me/events', data, 'POST', postResult);
}
});
As #Cbroe said, the create_event permission was deprecated with the introduction of Graph API v2.0:
https://developers.facebook.com/docs/apps/changelog#v2_0_permissions
create_event is no longer available.

Categories

Resources